Function bson::from_slice_utf8_lossy[][src]

pub fn from_slice_utf8_lossy<'de, T>(bytes: &'de [u8]) -> Result<T> where
    T: Deserialize<'de>, 
Expand description

Deserialize an instance of type T from a slice of BSON bytes, replacing any invalid UTF-8 sequences with the Unicode replacement character.

This is mainly useful when reading raw BSON returned from a MongoDB server, which in rare cases can contain invalidly truncated strings (https://jira.mongodb.org/browse/SERVER-24007). For most use cases, crate::from_slice can be used instead.