[][src]Trait pui::runtime::IdAlloc

pub unsafe trait IdAlloc {
    type Id: Copy + Eq;
    pub fn alloc(&mut self) -> Self::Id;
pub fn try_alloc(&mut self) -> Option<Self::Id>; }

A id_alloc that allocates new ids

Safety

two equal ids may never exist together on the same thread

This implies that IdAlloc::*next() may never repeat an id on the same thread, and if it can repeat itself on different threads then Self: !Send + !Sync and Self::Id:: !Send + !Sync.

Associated Types

type Id: Copy + Eq[src]

The unique identifiers that this allocator produces

Loading content...

Required methods

pub fn alloc(&mut self) -> Self::Id[src]

Get the next id, panics if there are no next ids

pub fn try_alloc(&mut self) -> Option<Self::Id>[src]

Try to get the next id, returns None if there are no next ids

Loading content...

Implementors

impl IdAlloc for Global[src]

type Id = GlobalId

Loading content...