pub fn to_bson<T>(value: &T) -> Result<Bson>where
T: Serialize + ?Sized,Expand description
Encode a T Serializable into a Bson value.
The Serializer used by this function presents itself as human readable, whereas the
one used in to_vec does not. This means that this function will produce different BSON than
to_vec for types that change their serialization output depending on whether
the format is human readable or not. To serialize to a Document with a serializer that
presents itself as not human readable, use to_bson_with_options with
SerializerOptions::human_readable set to false.