pub enum SchemaType {
Show 14 variants
Null,
Unknown,
Array(Box<ArrayType>),
Boolean(Box<BooleanType>),
Enum(Box<EnumType>),
Float(Box<FloatType>),
Integer(Box<IntegerType>),
Literal(Box<LiteralType>),
Object(Box<ObjectType>),
Reference(String),
Struct(Box<StructType>),
String(Box<StringType>),
Tuple(Box<TupleType>),
Union(Box<UnionType>),
}Expand description
All possible types within a schema.
Variants§
Null
Unknown
Array(Box<ArrayType>)
Boolean(Box<BooleanType>)
Enum(Box<EnumType>)
Float(Box<FloatType>)
Integer(Box<IntegerType>)
Literal(Box<LiteralType>)
Object(Box<ObjectType>)
Reference(String)
Struct(Box<StructType>)
String(Box<StringType>)
Tuple(Box<TupleType>)
Union(Box<UnionType>)
Implementations§
Source§impl SchemaType
impl SchemaType
Sourcepub fn get_default(&self) -> Option<&LiteralValue>
pub fn get_default(&self) -> Option<&LiteralValue>
Return a default value from the inner schema type.
Sourcepub fn is_nullable(&self) -> bool
pub fn is_nullable(&self) -> bool
Return true if the schema is nullable (a union with a null).
Sourcepub fn is_reference(&self) -> bool
pub fn is_reference(&self) -> bool
Return true if the schema is a reference.
Sourcepub fn set_default(&mut self, default: LiteralValue)
pub fn set_default(&mut self, default: LiteralValue)
Set the default of the inner schema type.
Sourcepub fn add_field(&mut self, key: &str, value: impl Into<SchemaField>)
pub fn add_field(&mut self, key: &str, value: impl Into<SchemaField>)
Add a field to the type if it’s a struct.
Trait Implementations§
Source§impl Clone for SchemaType
impl Clone for SchemaType
Source§fn clone(&self) -> SchemaType
fn clone(&self) -> SchemaType
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SchemaType
impl Debug for SchemaType
Source§impl Default for SchemaType
impl Default for SchemaType
Source§fn default() -> SchemaType
fn default() -> SchemaType
Returns the “default value” for a type. Read more
Source§impl Display for SchemaType
impl Display for SchemaType
Source§impl From<Schema> for SchemaType
impl From<Schema> for SchemaType
Source§impl From<SchemaType> for Schema
impl From<SchemaType> for Schema
Source§fn from(val: SchemaType) -> Self
fn from(val: SchemaType) -> Self
Converts to this type from the input type.
Source§impl PartialEq for SchemaType
impl PartialEq for SchemaType
Source§impl Schematic for SchemaType
impl Schematic for SchemaType
Source§fn schema_name() -> Option<String>
fn schema_name() -> Option<String>
Define a name for this schema type. Names are required for non-primitive values
as a means to link references, and avoid cycles.
Source§fn build_schema(schema: SchemaBuilder) -> Schema
fn build_schema(schema: SchemaBuilder) -> Schema
Create and return a schema that models the structure of the implementing type.
The schema can be used to generate code, documentation, or other artifacts.
impl StructuralPartialEq for SchemaType
Auto Trait Implementations§
impl Freeze for SchemaType
impl RefUnwindSafe for SchemaType
impl Send for SchemaType
impl Sync for SchemaType
impl Unpin for SchemaType
impl UnwindSafe for SchemaType
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