pub struct DocumentSnapshot<'a> { /* private fields */ }Expand description
A snapshot of a document in Firestore.
It contains data read from a document in your Firestore database.
The data can be extracted with .data().
Implementations§
Source§impl<'a> DocumentSnapshot<'a>
impl<'a> DocumentSnapshot<'a>
Sourcepub fn reference(&self) -> &DocumentReference<'a>
pub fn reference(&self) -> &DocumentReference<'a>
The DocumentReference for the document.
Sourcepub fn create_time(&self) -> Option<&str>
pub fn create_time(&self) -> Option<&str>
The time the document was created. Returns None if the document does not exist.
Sourcepub fn update_time(&self) -> Option<&str>
pub fn update_time(&self) -> Option<&str>
The time the document was last updated. Returns None if the document does not exist.
Sourcepub fn data<T: DeserializeOwned>(&self) -> Result<Option<T>, FirestoreError>
pub fn data<T: DeserializeOwned>(&self) -> Result<Option<T>, FirestoreError>
Retrieves all fields in the document as a specific type.
Returns Ok(None) if the document does not exist.
Sourcepub fn get_field<T: DeserializeOwned>(
&self,
path: &str,
) -> Result<Option<T>, FirestoreError>
pub fn get_field<T: DeserializeOwned>( &self, path: &str, ) -> Result<Option<T>, FirestoreError>
Retrieves a specific field from the document.
§Arguments
path- The path to the field (e.g., “address.city”).
Trait Implementations§
Source§impl<'a> Clone for DocumentSnapshot<'a>
impl<'a> Clone for DocumentSnapshot<'a>
Source§fn clone(&self) -> DocumentSnapshot<'a>
fn clone(&self) -> DocumentSnapshot<'a>
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<'a> Freeze for DocumentSnapshot<'a>
impl<'a> !RefUnwindSafe for DocumentSnapshot<'a>
impl<'a> Send for DocumentSnapshot<'a>
impl<'a> Sync for DocumentSnapshot<'a>
impl<'a> Unpin for DocumentSnapshot<'a>
impl<'a> !UnwindSafe for DocumentSnapshot<'a>
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