pub struct DocumentName(/* private fields */);Expand description
A document’s name within its DocumentScope, such as Binary/123.
Names are non-empty UTF-8 of at most 1024 bytes with no control characters,
no leading slash and no empty, . or .. segments. Slashes mean nothing
to an object store, but they keep related documents together and keep
names safe for a filesystem-backed implementation.
Implementations§
Source§impl DocumentName
impl DocumentName
Sourcepub fn new(name: impl Into<String>) -> Result<Self, StorageError>
pub fn new(name: impl Into<String>) -> Result<Self, StorageError>
Validates name against the rules above.
§Errors
Returns StorageError::InvalidName naming the broken rule.
Sourcepub fn from_backend(name: String) -> Self
pub fn from_backend(name: String) -> Self
Wraps a name read back from a backend without validating it. Only backends should call this; whatever is in the store is reported as is.
pub fn as_str(&self) -> &str
Trait Implementations§
Source§impl AsRef<str> for DocumentName
impl AsRef<str> for DocumentName
Source§impl Clone for DocumentName
impl Clone for DocumentName
Source§impl Debug for DocumentName
impl Debug for DocumentName
Source§impl Display for DocumentName
impl Display for DocumentName
impl Eq for DocumentName
Source§impl From<DocumentName> for String
impl From<DocumentName> for String
Source§fn from(name: DocumentName) -> Self
fn from(name: DocumentName) -> Self
Converts to this type from the input type.
Source§impl FromStr for DocumentName
impl FromStr for DocumentName
Source§impl Hash for DocumentName
impl Hash for DocumentName
Source§impl Ord for DocumentName
impl Ord for DocumentName
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for DocumentName
impl PartialEq for DocumentName
Source§impl PartialOrd for DocumentName
impl PartialOrd for DocumentName
impl StructuralPartialEq for DocumentName
Auto Trait Implementations§
impl Freeze for DocumentName
impl RefUnwindSafe for DocumentName
impl Send for DocumentName
impl Sync for DocumentName
impl Unpin for DocumentName
impl UnsafeUnpin for DocumentName
impl UnwindSafe for DocumentName
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
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more