pub enum Schema {
Scalar(ScalarKind),
Enum(Vec<String>),
List(Box<Schema>),
Record(Vec<Field>),
}Expand description
The declared shape of a value. Mirrors lattice_config::ConfigSchema.
§Examples
use lattice_plugin_sdk::shape::{ConfigShape, ScalarKind, Schema};
// The constructors are shorthands for the scalar / list forms.
assert_eq!(Schema::int(), Schema::Scalar(ScalarKind::Int));
assert_eq!(<Vec<String> as ConfigShape>::schema(), Schema::list(Schema::string()));Variants§
Scalar(ScalarKind)
A single leaf of the given kind.
Enum(Vec<String>)
A closed set of strings; a value must be a Value::Str spelling one
of them. #[derive(ConfigShape)] on an all-unit enum produces this,
variants kebab-cased in declaration order — and it is what lets
:customize offer a picker instead of a text field.
List(Box<Schema>)
A homogeneous list whose every element has the inner shape.
Record(Vec<Field>)
A struct-like record: named fields, each with its own shape, doc and required flag. Field order is declaration order.
Implementations§
Trait Implementations§
impl Eq for Schema
impl StructuralPartialEq for Schema
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
impl UnwindSafe for Schema
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