FaceTable

Struct FaceTable 

Source
pub struct FaceTable { /* private fields */ }
Expand description

Concurrent map from FaceId to a type-erased face handle.

Pipeline stages clone the Arc<dyn ErasedFace> out of the table and release the table reference before calling send(), so no lock is held during I/O.

Face IDs are recycled: when a face is removed its ID is returned to a free list and reused by the next alloc_id() call. Reserved IDs (>= 0xFFFF_0000) are never allocated by alloc_id() and are used for internal engine faces (e.g. the management AppFace).

Implementations§

Source§

impl FaceTable

Source

pub fn new() -> Self

Source

pub fn alloc_id(&self) -> FaceId

Allocate the next available FaceId, reusing a recycled ID if possible.

Never returns an ID in the reserved range (>= RESERVED_FACE_ID_MIN).

Source

pub fn insert<F: Face>(&self, face: F) -> FaceId

Register a face. Returns the assigned FaceId.

Source

pub fn insert_arc(&self, face: Arc<dyn ErasedFace>) -> FaceId

Register a pre-wrapped erased face (e.g. a face accepted from a listener that is already stored in an Arc). Returns the face’s FaceId.

Source

pub fn get(&self, id: FaceId) -> Option<Arc<dyn ErasedFace>>

Look up a face handle. Returns None if the face has been removed.

Source

pub fn remove(&self, id: FaceId)

Remove a face from the table, recycling its ID for future alloc_id() calls.

Source

pub fn len(&self) -> usize

Number of registered faces.

Source

pub fn is_empty(&self) -> bool

Source

pub fn face_ids(&self) -> Vec<FaceId>

Iterate over all registered face IDs.

Source

pub fn face_entries(&self) -> Vec<(FaceId, FaceKind)>

Return all registered faces as (FaceId, FaceKind) pairs.

Source

pub fn face_info(&self) -> Vec<FaceInfo>

Return detailed info for all registered faces.

Trait Implementations§

Source§

impl Default for FaceTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.