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 declarations, resolving pack imports from
packs, keyed by registered pack id or external pack URI.
Sourcepub fn apply(
&mut self,
declaration: &TypeDeclaration,
packs: &BTreeMap<String, Pack>,
) -> Result<()>
pub fn apply( &mut self, declaration: &TypeDeclaration, packs: &BTreeMap<String, Pack>, ) -> Result<()>
Applies one declaration: an inline definition or a pack import. Redefining an existing type replaces it; 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§fn clone(&self) -> TypeRegistry
fn clone(&self) -> TypeRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TypeRegistry
impl Debug for TypeRegistry
Source§impl Default for TypeRegistry
impl Default for TypeRegistry
Source§fn default() -> TypeRegistry
fn default() -> TypeRegistry
Returns the “default value” for a type. Read more
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