INNER CODE UNIT · Rust
fmt
mongodb/bson-rust · src/binary.rs:28
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(
fmt,
"Binary({:#x}, {})",
u8::from(self.subtype),
base64::encode(&self.bytes)
)
}
}
impl Binary {
/// Creates a [`Binary`] from a base64 string and optional [`BinarySubtype`]. If the
/// `subtype` argument is [`None`], the [`Binary`] constructed will default to
/// [`BinarySubtype::Generic`].
///
/// ```rust
/// # use bson::{Binary, error::Result};
/// # fn example() -> Result<()> {