Struct firestore_path::DocumentPath
source · pub struct DocumentPath { /* private fields */ }
Expand description
Implementations§
source§impl DocumentPath
impl DocumentPath
sourcepub fn new(collection_path: CollectionPath, document_id: DocumentId) -> Self
pub fn new(collection_path: CollectionPath, document_id: DocumentId) -> Self
Creates a new DocumentPath
.
Examples
use firestore_path::{CollectionPath,DocumentId,DocumentPath};
use std::str::FromStr;
let collection_path = CollectionPath::from_str("chatrooms")?;
let document_id = DocumentId::from_str("chatroom1")?;
let document_path = DocumentPath::new(collection_path, document_id);
assert_eq!(document_path.to_string(), "chatrooms/chatroom1");
sourcepub fn collection<E, T>(self, collection_id: T) -> Result<CollectionPath, Error>
pub fn collection<E, T>(self, collection_id: T) -> Result<CollectionPath, Error>
Creates a new DocumentPath
from this DocumentPath
and collection_id
.
Examples
use firestore_path::{CollectionPath,DocumentPath};
use std::str::FromStr;
let document_path = DocumentPath::from_str("chatrooms/chatroom1")?;
assert_eq!(
document_path.collection("messages")?,
CollectionPath::from_str("chatrooms/chatroom1/messages")?
);
sourcepub fn document_id(&self) -> &DocumentId
pub fn document_id(&self) -> &DocumentId
Returns the DocumentId
of this DocumentPath
.
Examples
use firestore_path::{DocumentId,DocumentPath};
use std::str::FromStr;
let document_path = DocumentPath::from_str("chatrooms/chatroom1")?;
assert_eq!(
document_path.document_id(),
&DocumentId::from_str("chatroom1")?
);
sourcepub fn parent(&self) -> &CollectionPath
pub fn parent(&self) -> &CollectionPath
Returns the parent CollectionPath
of this DocumentPath
.
Examples
use firestore_path::{CollectionPath,DocumentPath};
use std::str::FromStr;
let document_path = DocumentPath::from_str("chatrooms/chatroom1")?;
assert_eq!(
document_path.parent(),
&CollectionPath::from_str("chatrooms")?
);
Trait Implementations§
source§impl Clone for DocumentPath
impl Clone for DocumentPath
source§fn clone(&self) -> DocumentPath
fn clone(&self) -> DocumentPath
Returns a copy 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 moresource§impl Debug for DocumentPath
impl Debug for DocumentPath
source§impl Display for DocumentPath
impl Display for DocumentPath
source§impl From<DocumentPath> for CollectionPath
impl From<DocumentPath> for CollectionPath
source§fn from(document_path: DocumentPath) -> Self
fn from(document_path: DocumentPath) -> Self
Converts to this type from the input type.
source§impl From<DocumentPath> for DocumentId
impl From<DocumentPath> for DocumentId
source§fn from(document_path: DocumentPath) -> Self
fn from(document_path: DocumentPath) -> Self
Converts to this type from the input type.
source§impl FromStr for DocumentPath
impl FromStr for DocumentPath
source§impl Hash for DocumentPath
impl Hash for DocumentPath
source§impl Ord for DocumentPath
impl Ord for DocumentPath
source§fn cmp(&self, other: &DocumentPath) -> Ordering
fn cmp(&self, other: &DocumentPath) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for DocumentPath
impl PartialEq for DocumentPath
source§fn eq(&self, other: &DocumentPath) -> bool
fn eq(&self, other: &DocumentPath) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for DocumentPath
impl PartialOrd for DocumentPath
source§fn partial_cmp(&self, other: &DocumentPath) -> Option<Ordering>
fn partial_cmp(&self, other: &DocumentPath) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl TryFrom<&str> for DocumentPath
impl TryFrom<&str> for DocumentPath
source§impl TryFrom<String> for DocumentPath
impl TryFrom<String> for DocumentPath
impl Eq for DocumentPath
impl StructuralEq for DocumentPath
impl StructuralPartialEq for DocumentPath
Auto Trait Implementations§
impl RefUnwindSafe for DocumentPath
impl Send for DocumentPath
impl Sync for DocumentPath
impl Unpin for DocumentPath
impl UnwindSafe for DocumentPath
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