pub trait HasSchema {
// Required methods
fn schema() -> &'static [Field];
fn parts() -> &'static [&'static [Field]];
}Expand description
Associates a schema with the type it describes.
Lets lint and the docs build take a view generically without either naming the fourteen types, which is what stops a consumer growing its own list of them.
Required Methods§
Sourcefn parts() -> &'static [&'static [Field]]
fn parts() -> &'static [&'static [Field]]
The same schema in parts, own fields first.
A type that flattens a shared block holds those fields in a later part
rather than in schema, so a walk wanting everything
the type declares reads this instead. No view flattens at its root
today, which is why the two agree; one that did would leave a walk
built on schema quietly short of a block, and every nested descent
already goes through parts.
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.