pub struct StructuralSchema {
pub required_fields: Vec<String>,
pub optional_fields: Vec<String>,
pub field_types: HashMap<String, String>,
pub nested_schemas: HashMap<String, StructuralSchema>,
}Expand description
Schema for validating complex data structures
Fields§
§required_fields: Vec<String>§optional_fields: Vec<String>§field_types: HashMap<String, String>§nested_schemas: HashMap<String, StructuralSchema>Implementations§
Source§impl StructuralSchema
impl StructuralSchema
pub fn new() -> Self
pub fn require_field(self, field_name: &str, field_type: &str) -> Self
pub fn optional_field(self, field_name: &str, field_type: &str) -> Self
pub fn nested_schema(self, field_name: &str, schema: StructuralSchema) -> Self
Trait Implementations§
Source§impl Clone for StructuralSchema
impl Clone for StructuralSchema
Source§fn clone(&self) -> StructuralSchema
fn clone(&self) -> StructuralSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StructuralSchema
impl Debug for StructuralSchema
Source§impl Default for StructuralSchema
impl Default for StructuralSchema
Source§fn default() -> StructuralSchema
fn default() -> StructuralSchema
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StructuralSchema
impl RefUnwindSafe for StructuralSchema
impl Send for StructuralSchema
impl Sync for StructuralSchema
impl Unpin for StructuralSchema
impl UnwindSafe for StructuralSchema
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more