pub fn to_bson_with_options<T: ?Sized>(value: &T, options: SerializerOptions) -> Result<Bson>
where
    T: Serialize,
{
    let ser = Serializer::new_with_options(options);
    value.serialize(ser)
}
/// Encode a `T` into a `Bson` value, configuring the underlying serializer with the provided
/// options.
/// ```
/// # use serde::Serialize;
/// # use bson::{bson, SerializerOptions};
/// #[derive(Debug, Serialize)]
/// struct MyData {
///     a: String,
/// }
///
/// let data = MyData { a: "ok".to_string() };
/// let options = SerializerOptions::builder().human_readable(false).build();
/// let bson = bson::to_bson_with_options(&data, options)?;
/// assert_eq!(bson, bson!({ "a": "ok" }));
/// # Ok::<(), Box<dyn std::error::Error>>(())
/// ```
Encode a `T` into a `Bson` value, configuring the underlying serializer with the provided
options.
Encode a ` T ` into a ` Bson ` value configuring the underlying serializer with the provided options .
pub fn to_bson_with_options<T: ?Sized>(value: &T, options: SerializerOptions) -> Result<Bson>
where
    T: Serialize,
{
    let ser = Serializer::new_with_options(options);
    value.serialize(ser)
}
pub fn to_bson_with_options < T : ? Sized > ( value : & T , options : SerializerOptions ) -> Result < Bson > where T : Serialize , { let ser = Serializer :: new_with_options ( options ) ; value . serialize ( ser ) }
Encode a `T` into a `Bson` value, configuring the underlying serializer with the provided
options.
Encode a ` T ` into a ` Bson ` value configuring the underlying serializer with the provided options .
value
&T
options
SerializerOptions
value
&T
options
SerializerOptions
use serde::serialize;
None
use bson::{bson, serializeroptions};
None
[derive(debug, serialize)]
struct MyData {
a: String,
}

let data = MyData { a: "ok".to_string() };
let options = SerializerOptions::builder().human_readable(false).build();
let bson = bson::to_bson_with_options(&data, options)?;
assert_eq!(bson, bson!({ "a": "ok" })).
struct MyData { a : String } let data = MyData { a : " ok " . to_string () } ; let options = SerializerOptions :: builder () . human_readable ( false ) . build () ; let bson = bson :: to_bson_with_options ( &data options ) ? ; assert_eq! ( bson bson! ( { " a " : " ok " } )) .
ok::<(), box<dyn std::error::error>>(())
None