pub struct Id<T>(/* private fields */);Expand description
A string identifier for a resource in the registry.
The type parameter T indicates type of the underlying resource.
§Specifications
An Id consists of two parts: a module part for namespacing uses and a name part for identification.
Each part is an ASCII string made up with uppercase or lowercase letters, digits, hyphen, period and underscore,
with a maximum length of 12. i.e. ^[a-zA-Z0-9._-]{1,12}$.
The bahaviour is undefined unless conditions above are satisfied.
§String Representation
String representation for a certain Id would be the module part and name part concatenated by a slash (/).
e.g. module/name.
§Comparison
Id is guaranteed to have the same comparison behaviour as its corresponding string representation.
Implementations§
Source§impl<T> Id<T>
impl<T> Id<T>
Sourcepub const fn new(module: ArrayString<12>, name: ArrayString<12>) -> Id<T>
pub const fn new(module: ArrayString<12>, name: ArrayString<12>) -> Id<T>
Create an Id with specified module and name part.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Id<T>
impl<'de, T> Deserialize<'de> for Id<T>
Source§fn deserialize<__D>(
deserializer: __D,
) -> Result<Id<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
deserializer: __D,
) -> Result<Id<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> Ord for Id<T>
impl<T> Ord for Id<T>
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
Source§impl<T> PartialOrd for Id<T>
impl<T> PartialOrd for Id<T>
Source§impl<T> Serialize for Id<T>
impl<T> Serialize for Id<T>
Source§fn serialize<__S>(
&self,
serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> Copy for Id<T>
impl<T> Eq for Id<T>
Auto Trait Implementations§
impl<T> Freeze for Id<T>
impl<T> RefUnwindSafe for Id<T>where
T: RefUnwindSafe,
impl<T> Send for Id<T>where
T: Send,
impl<T> Sync for Id<T>where
T: Sync,
impl<T> Unpin for Id<T>where
T: Unpin,
impl<T> UnsafeUnpin for Id<T>
impl<T> UnwindSafe for Id<T>where
T: UnwindSafe,
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
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.