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
impl FaceTable
pub fn new() -> Self
Sourcepub fn alloc_id(&self) -> FaceId
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).
Sourcepub fn insert_arc(&self, face: Arc<dyn ErasedFace>) -> FaceId
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.
Sourcepub fn get(&self, id: FaceId) -> Option<Arc<dyn ErasedFace>>
pub fn get(&self, id: FaceId) -> Option<Arc<dyn ErasedFace>>
Look up a face handle. Returns None if the face has been removed.
Sourcepub fn remove(&self, id: FaceId)
pub fn remove(&self, id: FaceId)
Remove a face from the table, recycling its ID for future alloc_id() calls.
pub fn is_empty(&self) -> bool
Sourcepub fn face_entries(&self) -> Vec<(FaceId, FaceKind)>
pub fn face_entries(&self) -> Vec<(FaceId, FaceKind)>
Return all registered faces as (FaceId, FaceKind) pairs.