pub struct DataType {
pub name: String,
pub description: Option<String>,
pub data: DataTypeData,
}Expand description
Any data type (struct, variant, ect.)
Fields§
§name: StringThe name of the type
description: Option<String>The description of the type
data: DataTypeDataThe type specific data
Implementations§
Source§impl DataType
impl DataType
Sourcepub fn get_dart<'a>(
&self,
indent: usize,
macros: &'a HashMap<String, SerializationModel>,
) -> Result<String, Error>
pub fn get_dart<'a>( &self, indent: usize, macros: &'a HashMap<String, SerializationModel>, ) -> Result<String, Error>
Generates the Dart source code for a the type
§Parameters
indent: The number of spaces per indentation level
macros: The macros defined in the data model used for expanding default values
Source§impl DataType
impl DataType
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
§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 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<'de> Deserialize<'de> for DataType
impl<'de> Deserialize<'de> for DataType
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 DataType
Auto Trait Implementations§
impl Freeze for DataType
impl RefUnwindSafe for DataType
impl Send for DataType
impl Sync for DataType
impl Unpin for DataType
impl UnsafeUnpin for DataType
impl UnwindSafe for DataType
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