pub trait Schema {
type EntityTypeDescription: EntityTypeDescription;
type ActionEntityIterator: IntoIterator<Item = Arc<Entity>>;
// Required methods
fn entity_type(
&self,
entity_type: &EntityType,
) -> Option<Self::EntityTypeDescription>;
fn action(&self, action: &EntityUID) -> Option<Arc<Entity>>;
fn entity_types_with_basename<'a>(
&'a self,
basename: &'a UnreservedId,
) -> Box<dyn Iterator<Item = EntityType> + 'a>;
fn action_entities(&self) -> Self::ActionEntityIterator;
}Expand description
Trait for Schemas that can inform the parsing of Entity JSON data
Required Associated Types§
Sourcetype EntityTypeDescription: EntityTypeDescription
type EntityTypeDescription: EntityTypeDescription
Type returned by entity_type(). Must implement the EntityTypeDescription trait
Sourcetype ActionEntityIterator: IntoIterator<Item = Arc<Entity>>
type ActionEntityIterator: IntoIterator<Item = Arc<Entity>>
Type returned by action_entities()
Required Methods§
Sourcefn entity_type(
&self,
entity_type: &EntityType,
) -> Option<Self::EntityTypeDescription>
fn entity_type( &self, entity_type: &EntityType, ) -> Option<Self::EntityTypeDescription>
Get an EntityTypeDescription for the given entity type, or None if that
entity type is not declared in the schema (in which case entities of that
type should not appear in the JSON data).
Sourcefn action(&self, action: &EntityUID) -> Option<Arc<Entity>>
fn action(&self, action: &EntityUID) -> Option<Arc<Entity>>
Get the entity information for the given action, or None if that
action is not declared in the schema (in which case this action should
not appear in the JSON data).
Sourcefn entity_types_with_basename<'a>(
&'a self,
basename: &'a UnreservedId,
) -> Box<dyn Iterator<Item = EntityType> + 'a>
fn entity_types_with_basename<'a>( &'a self, basename: &'a UnreservedId, ) -> Box<dyn Iterator<Item = EntityType> + 'a>
Get the names of all entity types declared in the schema that have the
given basename (in the sense of Name::basename()).
Sourcefn action_entities(&self) -> Self::ActionEntityIterator
fn action_entities(&self) -> Self::ActionEntityIterator
Get all the actions declared in the schema