pub struct EntityTypeRegistry { /* private fields */ }Expand description
Registry for (EntityKind, entity_type) pair validation and alias normalisation.
Implementations§
Source§impl EntityTypeRegistry
impl EntityTypeRegistry
Sourcepub fn new(defs: impl IntoIterator<Item = EntityTypeDef>) -> Self
pub fn new(defs: impl IntoIterator<Item = EntityTypeDef>) -> Self
Build a fresh registry from the supplied definitions.
Sourcepub fn with_extra(extra: impl IntoIterator<Item = EntityTypeDef>) -> Self
pub fn with_extra(extra: impl IntoIterator<Item = EntityTypeDef>) -> Self
Derive a registry that includes all built-in subtypes plus the caller-supplied extras (used by packs that extend the vocabulary).
Sourcepub fn register(&mut self, def: EntityTypeDef)
pub fn register(&mut self, def: EntityTypeDef)
Register additional subtypes into an existing registry clone.
Sourcepub fn resolve(
&self,
kind: EntityKind,
entity_type: Option<&str>,
) -> Result<ResolvedEntityType, EntityTypeError>
pub fn resolve( &self, kind: EntityKind, entity_type: Option<&str>, ) -> Result<ResolvedEntityType, EntityTypeError>
Validate and normalise a (kind, entity_type) wire pair.
Sourcepub fn valid_types_for(&self, kind: EntityKind) -> String
pub fn valid_types_for(&self, kind: EntityKind) -> String
Comma-separated list of canonical type names valid for kind.
Source§impl EntityTypeRegistry
impl EntityTypeRegistry
Sourcepub fn global() -> &'static EntityTypeRegistry
pub fn global() -> &'static EntityTypeRegistry
Return a reference to the module-level built-in registry.
Trait Implementations§
Source§impl Clone for EntityTypeRegistry
impl Clone for EntityTypeRegistry
Source§fn clone(&self) -> EntityTypeRegistry
fn clone(&self) -> EntityTypeRegistry
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 moreAuto Trait Implementations§
impl Freeze for EntityTypeRegistry
impl RefUnwindSafe for EntityTypeRegistry
impl Send for EntityTypeRegistry
impl Sync for EntityTypeRegistry
impl Unpin for EntityTypeRegistry
impl UnsafeUnpin for EntityTypeRegistry
impl UnwindSafe for EntityTypeRegistry
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