Struct firestore_path::DatabaseName
source · pub struct DatabaseName { /* private fields */ }
Expand description
A database name.
Format
projects/{project_id}/databases/{database_id}/documents
Examples
use firestore_path::DatabaseName;
use std::str::FromStr;
let database_name = DatabaseName::from_str("projects/my-project/databases/my-database/documents")?;
assert_eq!(database_name.to_string(), "projects/my-project/databases/my-database/documents");
Implementations§
source§impl DatabaseName
impl DatabaseName
sourcepub fn new(project_id: ProjectId, database_id: DatabaseId) -> Self
pub fn new(project_id: ProjectId, database_id: DatabaseId) -> Self
Creates a new DatabaseName
.
Examples
use firestore_path::{DatabaseId,DatabaseName,ProjectId};
use std::str::FromStr;
let project_id = ProjectId::from_str("my-project")?;
let database_id = DatabaseId::from_str("my-database")?;
let database_name = DatabaseName::new(project_id, database_id);
assert_eq!(database_name.to_string(), "projects/my-project/databases/my-database/documents");
sourcepub fn collection<E, T>(self, collection_id: T) -> Result<CollectionName, Error>
pub fn collection<E, T>(self, collection_id: T) -> Result<CollectionName, Error>
Creates a new CollectionName
from this DatabaseName
and collection_id
.
Examples
use firestore_path::{CollectionName,DatabaseName};
use std::str::FromStr;
let database_name = DatabaseName::from_str("projects/my-project/databases/my-database/documents")?;
assert_eq!(
database_name.collection("chatrooms")?,
CollectionName::from_str("projects/my-project/databases/my-database/documents/chatrooms")?
);
Trait Implementations§
source§impl Clone for DatabaseName
impl Clone for DatabaseName
source§fn clone(&self) -> DatabaseName
fn clone(&self) -> DatabaseName
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 DatabaseName
impl Debug for DatabaseName
source§impl Display for DatabaseName
impl Display for DatabaseName
source§impl From<CollectionName> for DatabaseName
impl From<CollectionName> for DatabaseName
source§fn from(collection_name: CollectionName) -> Self
fn from(collection_name: CollectionName) -> Self
Converts to this type from the input type.
source§impl From<DocumentName> for DatabaseName
impl From<DocumentName> for DatabaseName
source§fn from(document_name: DocumentName) -> Self
fn from(document_name: DocumentName) -> Self
Converts to this type from the input type.
source§impl FromStr for DatabaseName
impl FromStr for DatabaseName
source§impl Hash for DatabaseName
impl Hash for DatabaseName
source§impl Ord for DatabaseName
impl Ord for DatabaseName
source§fn cmp(&self, other: &DatabaseName) -> Ordering
fn cmp(&self, other: &DatabaseName) -> 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 DatabaseName
impl PartialEq for DatabaseName
source§fn eq(&self, other: &DatabaseName) -> bool
fn eq(&self, other: &DatabaseName) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for DatabaseName
impl PartialOrd for DatabaseName
source§fn partial_cmp(&self, other: &DatabaseName) -> Option<Ordering>
fn partial_cmp(&self, other: &DatabaseName) -> 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 DatabaseName
impl TryFrom<&str> for DatabaseName
source§impl TryFrom<String> for DatabaseName
impl TryFrom<String> for DatabaseName
impl Eq for DatabaseName
impl StructuralEq for DatabaseName
impl StructuralPartialEq for DatabaseName
Auto Trait Implementations§
impl RefUnwindSafe for DatabaseName
impl Send for DatabaseName
impl Sync for DatabaseName
impl Unpin for DatabaseName
impl UnwindSafe for DatabaseName
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