[][src]Struct nitric_component::id::CheckedId

pub struct CheckedId<'merger, ID: Id + MergingDeletion> { /* fields omitted */ }

Represents an ID that is guaranteed to be valid.

Implements ValidId to allow calling methods that expect ValidIds, and can thus skip validity checks. This means we can ensure at type-level that a function cannot fail.

Methods

impl<'merger, ID> CheckedId<'merger, ID> where
    ID: Id + MergingDeletion
[src]

Creates a new checked ID from an id, the usize representation and a reference to the merger of the Id's allocator.

Contract

  • id must be valid for as long as allocator is borrowed

Returns a reference to the wrapped ID.

Trait Implementations

impl<'merger, ID> Id for CheckedId<'merger, ID> where
    ID: Id + MergingDeletion + 'merger, 
[src]

The allocator which manages IDs of this type.

The unique key of this ID.

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

impl<'merger, ID> WrapperId for CheckedId<'merger, ID> where
    ID: MergingDeletion + Id + 'merger, 
[src]

The wrapped, original ID type.

impl<'merger, ID: Id + MergingDeletion> PartialEq<CheckedId<'merger, ID>> for CheckedId<'merger, ID> where
    ID: PartialEq
[src]

This method tests for !=.

impl<'merger, ID: Id + MergingDeletion> Clone for CheckedId<'merger, ID> where
    ID: Clone
[src]

Performs copy-assignment from source. Read more

impl<'merger, ID: Id + MergingDeletion> Copy for CheckedId<'merger, ID> where
    ID: Copy,
    ID::Key: Copy
[src]

impl<'merger, ID: Id + MergingDeletion> Eq for CheckedId<'merger, ID> where
    ID: Eq
[src]

impl<'merger, ID: Id + MergingDeletion> Debug for CheckedId<'merger, ID> where
    ID: Debug
[src]

impl<'merger, ID: Id + MergingDeletion> Hash for CheckedId<'merger, ID> where
    ID: Hash
[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl<'merger, ID> Send for CheckedId<'merger, ID> where
    ID: Send,
    <ID as Id>::Key: Send,
    <ID as MergingDeletion>::Merger: Sync

impl<'merger, ID> Sync for CheckedId<'merger, ID> where
    ID: Sync,
    <ID as Id>::Key: Sync,
    <ID as MergingDeletion>::Merger: Sync

Blanket Implementations

impl<T> Continuous for T where
    T: Id<Key = usize> + WrapperId,
    <T as WrapperId>::Original: Continuous
[src]

impl<T> MergingDeletion for T where
    T: WrapperId,
    <T as WrapperId>::Original: Id,
    <T as WrapperId>::Original: MergingDeletion,
    <<T as WrapperId>::Original as Id>::Key == <T as Id>::Key
[src]

The merger for this ID. You should make sure that the merger cannot be duplicated. It's usually a good idea to use nitric_component::allocator::Merger for this. Read more

Checks if this ID is valid and returns a CheckedId which implements ValidId, or an error in case self is invalid. Read more

impl<T> SparseLinear for T where
    T: Id<Key = usize> + WrapperId,
    <T as WrapperId>::Original: SparseLinear
[src]

This is the bit set type that can be used by the storage. A storage which maps this ID type stores a field of type Self::BitSet, which will be used to check if a component exists for a particular ID. Read more

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

impl<T> From for T
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]