pub struct Document { /* private fields */ }
Expand description
The bson document.
Since bson in litedb uses case-insensitive key comparison, this implementation does so.
Implementations§
Source§impl Document
impl Document
pub fn new() -> Document
pub fn with_capacity(capacity: usize) -> Document
Sourcepub fn try_get(&self, key: impl AsRef<str>) -> Option<&Value>
pub fn try_get(&self, key: impl AsRef<str>) -> Option<&Value>
Gets the value with key
, or None if not exists
pub fn get_mut(&mut self, key: impl AsRef<str>) -> Option<&mut Value>
pub fn contains_key(&self, key: impl AsRef<str>) -> bool
pub fn remove(&mut self, key: impl AsRef<str>) -> Option<Value>
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn iter(&self) -> impl Iterator<Item = (&str, &Value)> + Clone
pub fn clear(&mut self)
pub fn entry(&mut self, key: impl Into<String>) -> Entry<'_>
Source§impl Document
impl Document
Sourcepub fn get_serialized_value_len(&self) -> usize
pub fn get_serialized_value_len(&self) -> usize
Returns the size of serialized value.
This doesn’t include tag or name of key.
Sourcepub fn write_value<W: BsonWriter>(
&self,
w: &mut W,
) -> Result<(), <W as BsonWriter>::Error>
pub fn write_value<W: BsonWriter>( &self, w: &mut W, ) -> Result<(), <W as BsonWriter>::Error>
Writes the value to the BsonWriter
Sourcepub fn parse_document<R: BsonReader>(
r: &mut R,
) -> Result<Document, <R as BsonReader>::Error>
pub fn parse_document<R: BsonReader>( r: &mut R, ) -> Result<Document, <R as BsonReader>::Error>
Parses the document
Trait Implementations§
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more