[][src]Trait nitric_component::id::ValidId

pub trait ValidId<O: Id>: Id<Key = O::Key> {
    fn as_inner(&self) -> &O;
fn into_inner(self) -> O;
fn as_key(&self) -> Cow<Self::Key>; }

Represents an ID that is guaranteed to be valid.

If you have an ID that may be valid or not, consider using .checked() to retrieve a Checked instance which implements ValidId.



An ID implementing this type must be valid in terms of Allocator::is_valid for as long as it can be accessed.

Required Methods

Returns a reference to the original ID.

Consumes self and returns the owned, original ID.

Returns the key of this ID.

This operation cannot fail and is only available for IDs that have this property ensured at the type-level. For a dynamic version see Id::try_as_key.


impl<'merger, ID> ValidId<ID> for CheckedId<'merger, ID> where
    ID: Id + MergingDeletion + 'merger,