pub struct TypeRegistry { /* private fields */ }Expand description
The effective set of type definitions active in a room.
Implementations§
Source§impl TypeRegistry
impl TypeRegistry
pub fn new() -> Self
Sourcepub fn from_declarations(
declarations: &[TypeDeclaration],
packs: &BTreeMap<String, Pack>,
) -> Result<Self>
pub fn from_declarations( declarations: &[TypeDeclaration], packs: &BTreeMap<String, Pack>, ) -> Result<Self>
Materializes a registry from the room.create declarations, resolving
pack imports from packs, keyed by registered pack id or external pack
URI. A type name may appear only once across these declarations.
Sourcepub fn apply(
&mut self,
declaration: &TypeDeclaration,
packs: &BTreeMap<String, Pack>,
) -> Result<Vec<String>>
pub fn apply( &mut self, declaration: &TypeDeclaration, packs: &BTreeMap<String, Pack>, ) -> Result<Vec<String>>
Applies one declaration — an inline definition or a pack import — and returns the type names it declared. Declaring an existing type is a redefinition: it must keep the type’s kind, and the latest definition wins.
pub fn define(&mut self, def: TypeDef) -> Result<()>
pub fn get(&self, event_type: &str) -> Option<&TypeDef>
pub fn contains(&self, event_type: &str) -> bool
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn definitions(&self) -> impl Iterator<Item = &TypeDef>
Trait Implementations§
Source§impl Clone for TypeRegistry
impl Clone for TypeRegistry
Source§impl Debug for TypeRegistry
impl Debug for TypeRegistry
Auto Trait Implementations§
impl Freeze for TypeRegistry
impl RefUnwindSafe for TypeRegistry
impl Send for TypeRegistry
impl Sync for TypeRegistry
impl Unpin for TypeRegistry
impl UnsafeUnpin for TypeRegistry
impl UnwindSafe for TypeRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more