[][src]Trait nitric_component::allocator::Delete

pub trait Delete<ID>: Allocator<ID> where
    ID: Id<Allocator = Self>, 
{ fn is_flagged<V>(&self, id: &V) -> bool
        ID: MergingDeletion,
        V: ValidId<ID>
fn delete<V>(&mut self, id: &V)
        V: ValidId<ID>
fn try_delete(&mut self, id: &ID) -> Result<(), InvalidIdError<ID>>; fn assert_deleted(&mut self, id: &ID) { ... } }

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

Required Methods

Returns true if id is flagged for deletion.

Only available if ID implements MergingDeletion; if it doesn't, use Allocator::is_valid instead.

Flags a previously created ID that is guaranteed to be valid for deletion. For deleting eventually valid IDs, see try_delete.

In case your allocator supports atomic ID deletion, you should implement this for &Self, too.


This does not actually delete the ID. This just flags it for deletion; the allocator will require calling further methods for an actual deletion to happen.

Most commonly, this function is MergeDeleted::merge_deleted.

Calling this method twice with the same ID is perfectly correct, since IDs stay valid beyond a call to delete.


Panics in debug mode if id was allocated by a different allocator.

Flags a previously created ID for deletion, failing if the ID is invalid. See Delete::delete.

Provided Methods

Makes sure id is deleted, ignoring the case where deletion fails due to an invalid ID. See Delete::delete.


impl Delete<FlatUsize> for FlatAllocator