pub struct Binary {
pub subtype: BinarySubtype,
pub bytes: Vec<u8>,
}
Expand description
Represents a BSON binary value.
Fields
subtype: BinarySubtype
The subtype of the bytes.
bytes: Vec<u8>
The binary bytes.
Implementations
sourceimpl Binary
impl Binary
sourcepub fn from_uuid_with_representation(uuid: Uuid, rep: UuidRepresentation) -> Self
pub fn from_uuid_with_representation(uuid: Uuid, rep: UuidRepresentation) -> Self
Serializes a Uuid
into BSON binary type and takes the desired representation as a
parameter. Binary::from_uuid_with_representation(uuid, UuidRepresentation::Standard)
is
equivalent to Binary::from_uuid(uuid)
.
See the documentation for UuidRepresentation
for more information on the possible
representations.
sourcepub fn to_uuid_with_representation(
&self,
rep: UuidRepresentation
) -> Result<Uuid>
pub fn to_uuid_with_representation(
&self,
rep: UuidRepresentation
) -> Result<Uuid>
Deserializes a BSON Binary
type into a Uuid
according to the provided
representation. If the representation does not match the Binary
, an error will be
returned.
See the documentation for UuidRepresentation
for more information on the possible
representations.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Binary
impl<'de> Deserialize<'de> for Binary
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Binary
Auto Trait Implementations
impl RefUnwindSafe for Binary
impl Send for Binary
impl Sync for Binary
impl Unpin for Binary
impl UnwindSafe for Binary
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more