[][src]Trait nitric_component::allocator::CreateChecked

pub trait CreateChecked<ID>: Allocator<ID> + Create<ID> where
    ID: Id<Allocator = Self> + MergingDeletion
{ fn create_checked<'merger>(
        &mut self,
        merger: &'merger ID::Merger
    ) -> Result<CheckedId<'merger, ID>, OomError> { ... } }

Trait implemented by allocators that can create new IDs, atomically and without additional arguments.

Provided Methods

Creates a new ID of type <Self as Allocator>::Id and wraps it in a CheckedId. Also see Create::create.

This is useful because it allows you to perform operations after an ID creation without the need to unwrap impossible errors (since your ID implements ValidId.

Once you're done, you'll want to get the inner ID again using CheckedId::into_inner.

This has a naive default implementation that can be replaced with a custom one if required.

Implementors

impl CreateChecked<FlatUsize> for FlatAllocator
[src]