pub struct Schema {
pub title: Option<String>,
pub description: Option<String>,
pub rules: Vec<SchemaRule>,
pub optional: bool,
pub default: Option<Value>,
}Expand description
A complete schema definition
Fields§
§title: Option<String>Schema title/description
description: Option<String>Schema description
rules: Vec<SchemaRule>Validation rules for this schema
optional: boolWhether this schema is optional
default: Option<Value>Default value if not provided
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn rule(self, rule: SchemaRule) -> Self
pub fn rule(self, rule: SchemaRule) -> Self
Add a validation rule
Sourcepub fn rules(self, rules: Vec<SchemaRule>) -> Self
pub fn rules(self, rules: Vec<SchemaRule>) -> Self
Add multiple validation rules
Sourcepub fn default_value(self, value: Value) -> Self
pub fn default_value(self, value: Value) -> Self
Set default value
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin 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