pub struct DocumentKey(/* private fields */);Expand description
A validated object key such as tenant/project/Binary/123.
Keys 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 listable by prefix and
keep keys safe for a filesystem-backed implementation.
Implementations§
Source§impl DocumentKey
impl DocumentKey
Sourcepub fn new(key: impl Into<String>) -> Result<Self, StorageError>
pub fn new(key: impl Into<String>) -> Result<Self, StorageError>
Validates key against the rules above.
§Errors
Returns StorageError::InvalidKey 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 DocumentKey
impl AsRef<str> for DocumentKey
Source§impl Clone for DocumentKey
impl Clone for DocumentKey
Source§impl Debug for DocumentKey
impl Debug for DocumentKey
Source§impl Display for DocumentKey
impl Display for DocumentKey
impl Eq for DocumentKey
Source§impl From<DocumentKey> for String
impl From<DocumentKey> for String
Source§fn from(key: DocumentKey) -> Self
fn from(key: DocumentKey) -> Self
Converts to this type from the input type.
Source§impl FromStr for DocumentKey
impl FromStr for DocumentKey
Source§impl Hash for DocumentKey
impl Hash for DocumentKey
Source§impl Ord for DocumentKey
impl Ord for DocumentKey
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 DocumentKey
impl PartialEq for DocumentKey
Source§impl PartialOrd for DocumentKey
impl PartialOrd for DocumentKey
impl StructuralPartialEq for DocumentKey
Auto Trait Implementations§
impl Freeze for DocumentKey
impl RefUnwindSafe for DocumentKey
impl Send for DocumentKey
impl Sync for DocumentKey
impl Unpin for DocumentKey
impl UnsafeUnpin for DocumentKey
impl UnwindSafe for DocumentKey
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