Skip to content

Commit

Permalink
RUST-846 Update Bson's Display impl to use driver type names (crosste…
Browse files Browse the repository at this point in the history
  • Loading branch information
abr-egn authored Jun 24, 2021
1 parent adb3a06 commit 84ced4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/bson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ impl Display for Bson {
}
Bson::Binary(Binary { subtype, ref bytes }) => write!(
fmt,
"BinData({:#x}, {})",
"Binary({:#x}, {})",
u8::from(subtype),
base64::encode(bytes)
),
Bson::ObjectId(ref id) => write!(fmt, "ObjectId(\"{}\")", id),
Bson::DateTime(date_time) => write!(fmt, "Date(\"{}\")", date_time),
Bson::DateTime(date_time) => write!(fmt, "DateTime(\"{}\")", date_time),
Bson::Symbol(ref sym) => write!(fmt, "Symbol(\"{}\")", sym),
Bson::Decimal128(ref d) => write!(fmt, "{}", d),
Bson::Undefined => write!(fmt, "undefined"),
Expand All @@ -141,7 +141,7 @@ impl Display for Bson {
Bson::DbPointer(DbPointer {
ref namespace,
ref id,
}) => write!(fmt, "DBPointer({}, {})", namespace, id),
}) => write!(fmt, "DbPointer({}, {})", namespace, id),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/tests/modules/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ fn standard_format() {
"{{ float: 2.4, string: \"hello\", array: [\"testing\", 1, true, [1, 2]], doc: {{ fish: \
\"in\", a: \"barrel\", !: 1 }}, bool: true, null: null, regexp: /s[ao]d/i, \
with_wrapped_parens: -20, code: function(x) {{ return x._id; }}, i32: 12, i64: -55, \
timestamp: Timestamp(0, 229999444), binary: BinData(0x5, {}), encrypted: BinData(0x6, \
{}), _id: ObjectId(\"{}\"), date: Date(\"{}\") }}",
timestamp: Timestamp(0, 229999444), binary: Binary(0x5, {}), encrypted: Binary(0x6, {}), \
_id: ObjectId(\"{}\"), date: DateTime(\"{}\") }}",
base64::encode("thingies"),
base64::encode("secret"),
hex::encode(id_string),
Expand Down

0 comments on commit 84ced4d

Please sign in to comment.