pub struct ResourcePath { /* private fields */ }Expand description
A slash-separated path: an even number of segments names a document (users/alice), an
odd number a collection (users, users/alice/posts). The empty path is the database root.
Implementations§
Source§impl ResourcePath
impl ResourcePath
pub fn root() -> Self
Sourcepub fn parse(path: &str) -> Option<Self>
pub fn parse(path: &str) -> Option<Self>
Splits on /. Returns None for empty segments (a//b, a leading or trailing /).
pub fn from_segments<I, S>(segments: I) -> Self
pub fn segments(&self) -> impl ExactSizeIterator<Item = &str> + Clone
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn is_document(&self) -> bool
pub fn is_collection(&self) -> bool
Sourcepub fn collection_id(&self) -> Option<&str>
pub fn collection_id(&self) -> Option<&str>
The ID of the collection this document belongs to.
pub fn parent(&self) -> Option<Self>
pub fn child(&self, segment: impl Into<String>) -> Self
pub fn starts_with(&self, prefix: &Self) -> bool
Trait Implementations§
Source§impl Clone for ResourcePath
impl Clone for ResourcePath
Source§impl Debug for ResourcePath
impl Debug for ResourcePath
Source§impl Default for ResourcePath
impl Default for ResourcePath
Source§impl Display for ResourcePath
impl Display for ResourcePath
impl Eq for ResourcePath
Source§impl Hash for ResourcePath
impl Hash for ResourcePath
Source§impl PartialEq for ResourcePath
impl PartialEq for ResourcePath
impl StructuralPartialEq for ResourcePath
Auto Trait Implementations§
impl Freeze for ResourcePath
impl RefUnwindSafe for ResourcePath
impl Send for ResourcePath
impl Sync for ResourcePath
impl Unpin for ResourcePath
impl UnsafeUnpin for ResourcePath
impl UnwindSafe for ResourcePath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
Wrap the input message
T in a tonic::Request