pub enum DataTypeData {
Struct(Struct),
Array(Array),
Variant(Variant),
Enum(Enum),
ConstrainedType(ConstrainedType),
}Expand description
Supplies the type specific information for a data type
Variants§
Struct(Struct)
Describes a struct
Array(Array)
Describes an array
Variant(Variant)
Describes a variant
Enum(Enum)
Describes an enum
ConstrainedType(ConstrainedType)
Describes a constrained type
Implementations§
Source§impl DataTypeData
impl DataTypeData
Sourcepub fn export_schema(
&self,
custom_types: &HashMap<String, DataType>,
dependencies: &mut HashSet<String>,
macros: &HashMap<String, SerializationModel>,
) -> Result<Object, Error>
pub fn export_schema( &self, custom_types: &HashMap<String, DataType>, dependencies: &mut HashSet<String>, macros: &HashMap<String, SerializationModel>, ) -> Result<Object, Error>
Creates a JSON schema from the data type data
§Parameters
custom_types: The map of all the custom types, used to check if a type is builtin or not
dependencies: A set to add all dependencies of this data type data to
macros: A map of all macros to expand default values
Sourcepub fn schema_value(
&self,
value: &SerializationModel,
custom_types: &HashMap<String, DataType>,
) -> Result<JsonValue, Error>
pub fn schema_value( &self, value: &SerializationModel, custom_types: &HashMap<String, DataType>, ) -> Result<JsonValue, Error>
Converts a serialization model value into a JSON value of the for of this type
§Parameters
value: The serialization model to convert
custom_types: All the custom types in the schema
Trait Implementations§
Source§impl Clone for DataTypeData
impl Clone for DataTypeData
Source§fn clone(&self) -> DataTypeData
fn clone(&self) -> DataTypeData
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 DataTypeData
impl Debug for DataTypeData
Source§impl<'de> Deserialize<'de> for DataTypeData
impl<'de> Deserialize<'de> for DataTypeData
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for DataTypeData
impl PartialEq for DataTypeData
Source§impl Serialize for DataTypeData
impl Serialize for DataTypeData
impl StructuralPartialEq for DataTypeData
Auto Trait Implementations§
impl Freeze for DataTypeData
impl RefUnwindSafe for DataTypeData
impl Send for DataTypeData
impl Sync for DataTypeData
impl Unpin for DataTypeData
impl UnwindSafe for DataTypeData
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