pub struct ObjectId {
pub context: ObjectContext,
pub key: String,
}Expand description
The fully qualified identifier of an object.
This consists of a usecase and the scopes, which make up the object’s context and define where the object belongs within objectstore, as well as the unique key within the context.
Fields§
§context: ObjectContextThe usecase and scopes this object belongs to.
key: StringThis key uniquely identifies the object within its usecase and scopes.
Note that keys can be reused across different contexts. Only in combination with the context a key makes a unique identifier.
Keys can be assigned by the service. For this, use ObjectId::random.
Implementations§
Source§impl ObjectId
impl ObjectId
Sourcepub fn new(context: ObjectContext, key: String) -> Self
pub fn new(context: ObjectContext, key: String) -> Self
Creates a new ObjectId with the given context and key.
Sourcepub fn from_parts(usecase: String, scopes: Scopes, key: String) -> Self
pub fn from_parts(usecase: String, scopes: Scopes, key: String) -> Self
Creates a new ObjectId from all of its parts.
Sourcepub fn random(context: ObjectContext) -> Self
pub fn random(context: ObjectContext) -> Self
Creates a unique ObjectId with a random key.
This can be used when creating an object with a server-generated key.
Sourcepub fn optional(context: ObjectContext, key: Option<String>) -> Self
pub fn optional(context: ObjectContext, key: Option<String>) -> Self
Creates a new ObjectId, generating a key if none is provided.
This creates a unique key like ObjectId::random if no key is provided, or otherwise
uses the provided key.
Sourcepub fn context(&self) -> &ObjectContext
pub fn context(&self) -> &ObjectContext
Returns the context of the object.
See context for more information.
Sourcepub fn usecase(&self) -> &str
pub fn usecase(&self) -> &str
Returns the usecase of the object.
See ObjectContext::usecase for more information.
Sourcepub fn scopes(&self) -> &Scopes
pub fn scopes(&self) -> &Scopes
Returns the scopes of the object.
See ObjectContext::scopes for more information.
Sourcepub fn iter_scopes(&self) -> impl Iterator<Item = &Scope>
pub fn iter_scopes(&self) -> impl Iterator<Item = &Scope>
Returns an iterator over all scopes of the object.
See ObjectContext::scopes for more information.
Sourcepub fn as_storage_path(&self) -> AsStoragePath<'_>
pub fn as_storage_path(&self) -> AsStoragePath<'_>
Returns a view that formats this ID as a storage path.
This will format a hierarchical path in the format
{usecase}/{scope1.key}.{scope1.value}/.../{key} that is intended to be used by backends to
reference the object in a storage system.
Trait Implementations§
impl Eq for ObjectId
impl StructuralPartialEq for ObjectId
Auto Trait Implementations§
impl Freeze for ObjectId
impl RefUnwindSafe for ObjectId
impl Send for ObjectId
impl Sync for ObjectId
impl Unpin for ObjectId
impl UnwindSafe for ObjectId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
§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
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].