pub struct Variant {
pub data_types: Vec<String>,
}Expand description
A variant which can be any of a number of different types, when parsing it will attempt to parse all types from the start until it is successful
Fields§
§data_types: Vec<String>The list of data types the variant can be
Implementations§
Source§impl Variant
impl Variant
Sourcepub fn export_schema(
&self,
custom_types: &HashMap<String, DataType>,
dependencies: &mut HashSet<String>,
) -> Result<Object, Error>
pub fn export_schema( &self, custom_types: &HashMap<String, DataType>, dependencies: &mut HashSet<String>, ) -> Result<Object, Error>
Creates a JSON schema from the variant
§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 variant to
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<'de> Deserialize<'de> for Variant
impl<'de> Deserialize<'de> for Variant
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
impl StructuralPartialEq for Variant
Auto Trait Implementations§
impl Freeze for Variant
impl RefUnwindSafe for Variant
impl Send for Variant
impl Sync for Variant
impl Unpin for Variant
impl UnsafeUnpin for Variant
impl UnwindSafe for Variant
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