pub trait SchemaFields<'a>: Sized {
// Required methods
fn add_field(&mut self, ctx: &'a ASTContext, field: SchemaField<'a>);
fn get_fields(
&self,
) -> HashMap<&'a str, &'a SchemaField<'a>, DefaultHashBuilder, &'a Bump>;
// Provided method
fn get_field(&self, name: &'a str) -> Option<&SchemaField<'a>> { ... }
}
Expand description
Generic trait for any schema type that implements fields
Required Methods§
Sourcefn add_field(&mut self, ctx: &'a ASTContext, field: SchemaField<'a>)
fn add_field(&mut self, ctx: &'a ASTContext, field: SchemaField<'a>)
Add a new SchemaField to the list of fields
Sourcefn get_fields(
&self,
) -> HashMap<&'a str, &'a SchemaField<'a>, DefaultHashBuilder, &'a Bump>
fn get_fields( &self, ) -> HashMap<&'a str, &'a SchemaField<'a>, DefaultHashBuilder, &'a Bump>
Get a [Map] of all fields
Provided Methods§
Sourcefn get_field(&self, name: &'a str) -> Option<&SchemaField<'a>>
fn get_field(&self, name: &'a str) -> Option<&SchemaField<'a>>
Get a known field by name
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.