pub struct Schema { /* private fields */ }Expand description
Cached schema for a type that may contain flattened fields.
This is computed once per Shape and can be cached forever since type information is static.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn build(shape: &'static Shape) -> Result<Self, SchemaError>
pub fn build(shape: &'static Shape) -> Result<Self, SchemaError>
Build a schema for the given shape with flattened enum representation.
Returns an error if the type definition contains conflicts, such as duplicate field names from parent and flattened structs.
Sourcepub fn build_externally_tagged(
shape: &'static Shape,
) -> Result<Self, SchemaError>
pub fn build_externally_tagged( shape: &'static Shape, ) -> Result<Self, SchemaError>
Build a schema for externally-tagged enum representation (e.g., JSON).
In this representation, the variant name appears as a key and the variant’s content is nested under it. The solver will only expect to see the variant name as a top-level key, not the variant’s fields.
Sourcepub fn build_with_repr(
shape: &'static Shape,
repr: EnumRepr,
) -> Result<Self, SchemaError>
pub fn build_with_repr( shape: &'static Shape, repr: EnumRepr, ) -> Result<Self, SchemaError>
Build a schema with the specified enum representation.
Sourcepub fn configurations(&self) -> &[Configuration]
pub fn configurations(&self) -> &[Configuration]
Get the configurations for this schema.
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