pub struct DocumentSnapshot { /* private fields */ }Expand description
Snapshot of a document’s contents.
Implementations§
Source§impl DocumentSnapshot
impl DocumentSnapshot
pub fn new( key: DocumentKey, data: Option<MapValue>, metadata: SnapshotMetadata, ) -> Self
Sourcepub fn data(&self) -> Option<&BTreeMap<String, FirestoreValue>>
pub fn data(&self) -> Option<&BTreeMap<String, FirestoreValue>>
Returns the decoded document fields if the snapshot contains data.
The returned map borrows from the snapshot; mutate a clone before writing it back to Firestore.
Sourcepub fn metadata(&self) -> &SnapshotMetadata
pub fn metadata(&self) -> &SnapshotMetadata
Returns snapshot metadata describing cache and mutation state.
Sourcepub fn map_value(&self) -> Option<&MapValue>
pub fn map_value(&self) -> Option<&MapValue>
Returns the underlying map value for advanced conversions.
Sourcepub fn from_cache(&self) -> bool
pub fn from_cache(&self) -> bool
Convenience accessor matching the JS API.
Sourcepub fn has_pending_writes(&self) -> bool
pub fn has_pending_writes(&self) -> bool
Convenience accessor matching the JS API.
Sourcepub fn reference(
&self,
firestore: Firestore,
) -> FirestoreResult<DocumentReference>
pub fn reference( &self, firestore: Firestore, ) -> FirestoreResult<DocumentReference>
Creates a document reference pointing at the same location as this snapshot.
Sourcepub fn into_typed<C>(self, converter: Arc<C>) -> TypedDocumentSnapshot<C>where
C: FirestoreDataConverter,
pub fn into_typed<C>(self, converter: Arc<C>) -> TypedDocumentSnapshot<C>where
C: FirestoreDataConverter,
Converts this snapshot into a typed snapshot using the provided converter.
Sourcepub fn to_typed<C>(&self, converter: Arc<C>) -> TypedDocumentSnapshot<C>where
C: FirestoreDataConverter,
pub fn to_typed<C>(&self, converter: Arc<C>) -> TypedDocumentSnapshot<C>where
C: FirestoreDataConverter,
Returns a typed snapshot by cloning the underlying data and converter.
Trait Implementations§
Source§impl Clone for DocumentSnapshot
impl Clone for DocumentSnapshot
Source§fn clone(&self) -> DocumentSnapshot
fn clone(&self) -> DocumentSnapshot
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DocumentSnapshot
impl RefUnwindSafe for DocumentSnapshot
impl Send for DocumentSnapshot
impl Sync for DocumentSnapshot
impl Unpin for DocumentSnapshot
impl UnwindSafe for DocumentSnapshot
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