pub enum Uid {
Singleton(Label),
Instance(u64, Option<Label>),
}Expand description
A unique identifier.
Singleton labels are identity. Instance labels are supplemental metadata and do not participate in equality, hashing, or ordering.
Variants§
Singleton(Label)
A singleton identified by label.
Instance(u64, Option<Label>)
An instance identified by a random u64, with an optional display label.
Implementations§
Source§impl Uid
impl Uid
Sourcepub fn is_singleton(&self) -> bool
pub fn is_singleton(&self) -> bool
Returns true if this is a Uid::Singleton, otherwise false
Sourcepub fn as_singleton_mut(&mut self) -> Option<&mut Label>
pub fn as_singleton_mut(&mut self) -> Option<&mut Label>
Optionally returns mutable references to the inner fields if this is a Uid::Singleton, otherwise None
Sourcepub fn as_singleton(&self) -> Option<&Label>
pub fn as_singleton(&self) -> Option<&Label>
Optionally returns references to the inner fields if this is a Uid::Singleton, otherwise None
Sourcepub fn into_singleton(self) -> Result<Label, Self>
pub fn into_singleton(self) -> Result<Label, Self>
Returns the inner fields if this is a Uid::Singleton, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_instance(&self) -> bool
pub fn is_instance(&self) -> bool
Returns true if this is a Uid::Instance, otherwise false
Sourcepub fn as_instance_mut(&mut self) -> Option<(&mut u64, &mut Option<Label>)>
pub fn as_instance_mut(&mut self) -> Option<(&mut u64, &mut Option<Label>)>
Optionally returns mutable references to the inner fields if this is a Uid::Instance, otherwise None
Source§impl Uid
impl Uid
Sourcepub fn instance(label: Label) -> Self
pub fn instance(label: Label) -> Self
Create a fresh instance with a random uid and display label.
Sourcepub fn label(&self) -> Option<&Label>
pub fn label(&self) -> Option<&Label>
Returns the display label for this uid, if present.
For singletons, the label is the identity. For instances, the label is supplemental metadata.
Sourcepub fn instance_uid_base58(&self) -> Option<String>
pub fn instance_uid_base58(&self) -> Option<String>
Returns the raw base58 uid for instances, without display delimiters.
Sourcepub fn parse_instance_uid_base58(s: &str) -> Result<u64, UidParseError>
pub fn parse_instance_uid_base58(s: &str) -> Result<u64, UidParseError>
Parses a raw base58 uid for instances, without display delimiters.
Sourcepub fn with_label(self, label: Option<Label>) -> Self
pub fn with_label(self, label: Option<Label>) -> Self
Returns this uid with the provided instance label.
Singleton labels are identity and are not replaced.
Trait Implementations§
Source§impl Debug for Uid
Displays as label (singleton), label<base58> (labeled instance), or
<base58> (unlabeled instance).
impl Debug for Uid
Displays as label (singleton), label<base58> (labeled instance), or
<base58> (unlabeled instance).
Source§impl<'de> Deserialize<'de> for Uid
impl<'de> Deserialize<'de> for Uid
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl FromStr for Uid
Parses label as singleton, <base58> as an unlabeled instance, and
label<base58> as a labeled instance.
impl FromStr for Uid
Parses label as singleton, <base58> as an unlabeled instance, and
label<base58> as a labeled instance.
Source§impl Ord for Uid
impl Ord for Uid
Source§impl PartialOrd for Uid
impl PartialOrd for Uid
impl Eq for Uid
Auto Trait Implementations§
impl Freeze for Uid
impl RefUnwindSafe for Uid
impl Send for Uid
impl Sync for Uid
impl Unpin for Uid
impl UnsafeUnpin for Uid
impl UnwindSafe for Uid
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> 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
§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<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<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§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>
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>
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>
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§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].