pub fn from_document_with_options<T>(doc: Document, options: DeserializerOptions) -> Result<T>
where
    T: DeserializeOwned,
{
    let de = Deserializer::new_with_options(Bson::Document(doc), options);
    Deserialize::deserialize(de)
}
/// Deserialize a `T` from the provided [`Document`], configuring the underlying
/// deserializer with the provided options.
/// ```
/// # use serde::Deserialize;
/// # use bson::{doc, DeserializerOptions};
/// #[derive(Debug, Deserialize, PartialEq)]
/// struct MyData {
///     a: String,
/// }
///
/// let doc = doc! { "a": "hello" };
/// let options = DeserializerOptions::builder().human_readable(false).build();
/// let data: MyData = bson::from_document_with_options(doc, options)?;
/// assert_eq!(data, MyData { a: "hello".to_string() });
/// # Ok::<(), Box<dyn std::error::Error>>(())
/// ```
Deserialize a `T` from the provided [`Document`], configuring the underlying
deserializer with the provided options.
Deserialize a ` T ` from the provided [ ` Document ` ] configuring the underlying deserializer with the provided options .
pub fn from_document_with_options<T>(doc: Document, options: DeserializerOptions) -> Result<T>
where
    T: DeserializeOwned,
{
    let de = Deserializer::new_with_options(Bson::Document(doc), options);
    Deserialize::deserialize(de)
}
pub fn from_document_with_options < T > ( doc : Document , options : DeserializerOptions ) -> Result < T > where T : DeserializeOwned , { let de = Deserializer :: new_with_options ( Bson :: Document ( doc ) , options ) ; Deserialize :: deserialize ( de ) }
Deserialize a `T` from the provided [`Document`], configuring the underlying
deserializer with the provided options.
Deserialize a ` T ` from the provided [ ` Document ` ] configuring the underlying deserializer with the provided options .
doc
Document
options
DeserializerOptions
doc
Document
options
DeserializerOptions
use serde::deserialize;
None
use bson::{doc, deserializeroptions};
None
[derive(debug, deserialize, partialeq)]
struct MyData {
a: String,
}

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