pub trait Schema {
    // Required methods
    fn attr_type(
        &self,
        entity_type: &EntityType,
        attr: &str
    ) -> Option<SchemaType>;
    fn required_attrs<'s>(
        &'s self,
        entity_type: &EntityType
    ) -> Box<dyn Iterator<Item = SmolStr> + 's>;
}
Expand description

Trait for Schemas that can inform the parsing of Entity JSON data

Required Methods§

source

fn attr_type(&self, entity_type: &EntityType, attr: &str) -> Option<SchemaType>

Do entities of the given type have the given attribute, and if so, what type?

Returning None indicates that attribute should not exist.

source

fn required_attrs<'s>( &'s self, entity_type: &EntityType ) -> Box<dyn Iterator<Item = SmolStr> + 's>

Get the names of all the required attributes for the given entity type.

Implementors§