pub struct ParentPathBuilder { /* private fields */ }Expand description
Re-exports all public items from the db module.
The db module contains the core FirestoreDb client and
functionalities for interacting with the Firestore database, such as CRUD operations,
queries, and transactions.
A builder for constructing Firestore document paths, typically for parent documents
when dealing with sub-collections.
ParentPathBuilder allows for fluently creating nested document paths.
It starts with an initial document path and allows appending further
collection and document ID segments.
This is often used to specify the parent document when performing operations on a sub-collection.
§Examples
use firestore::{FirestoreDb, FirestoreResult, ParentPathBuilder};
let db = FirestoreDb::new("my-project").await?;
// Path to "my-collection/my-doc"
let parent_path = db.parent_path("my-collection", "my-doc")?;
assert_eq!(parent_path.to_string(), "projects/my-project/databases/(default)/documents/my-collection/my-doc");
// Path to "my-collection/my-doc/sub-collection/sub-doc"
let sub_collection_path = parent_path.at("sub-collection", "sub-doc")?;
assert_eq!(sub_collection_path.to_string(), "projects/my-project/databases/(default)/documents/my-collection/my-doc/sub-collection/sub-doc");Implementations§
Source§impl ParentPathBuilder
impl ParentPathBuilder
Sourcepub fn at<S>(
self,
collection_name: &str,
document_id: S,
) -> FirestoreResult<Self>
pub fn at<S>( self, collection_name: &str, document_id: S, ) -> FirestoreResult<Self>
Appends a collection name and document ID to the current path.
This method extends the existing path with /collection_name/document_id.
§Arguments
collection_name: The name of the collection to append.document_id: The ID of the document within that collection.
§Errors
Returns FirestoreError::InvalidParametersError
if the document_id is invalid (e.g., contains /).
Trait Implementations§
Source§impl AsRef<str> for ParentPathBuilder
impl AsRef<str> for ParentPathBuilder
Source§impl Clone for ParentPathBuilder
impl Clone for ParentPathBuilder
Source§fn clone(&self) -> ParentPathBuilder
fn clone(&self) -> ParentPathBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParentPathBuilder
impl Debug for ParentPathBuilder
Source§impl Display for ParentPathBuilder
impl Display for ParentPathBuilder
Source§impl<'a> From<&'a ParentPathBuilder> for &'a str
impl<'a> From<&'a ParentPathBuilder> for &'a str
Source§fn from(pb: &'a ParentPathBuilder) -> &'a str
fn from(pb: &'a ParentPathBuilder) -> &'a str
Source§impl From<ParentPathBuilder> for String
impl From<ParentPathBuilder> for String
Source§fn from(pb: ParentPathBuilder) -> Self
fn from(pb: ParentPathBuilder) -> Self
Source§impl From<ParentPathBuilder> for FirestoreReference
impl From<ParentPathBuilder> for FirestoreReference
Source§fn from(pb: ParentPathBuilder) -> Self
fn from(pb: ParentPathBuilder) -> Self
Auto Trait Implementations§
impl Freeze for ParentPathBuilder
impl RefUnwindSafe for ParentPathBuilder
impl Send for ParentPathBuilder
impl Sync for ParentPathBuilder
impl Unpin for ParentPathBuilder
impl UnsafeUnpin for ParentPathBuilder
impl UnwindSafe for ParentPathBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request