pub enum TypeStructure {
Primitive(String),
Array(Box<TypeStructure>),
Map {
key: Box<TypeStructure>,
value: Box<TypeStructure>,
},
Set(Box<TypeStructure>),
Tuple(Vec<TypeStructure>),
Optional(Box<TypeStructure>),
Result(Box<TypeStructure>),
Custom(String),
}Expand description
Represents the structure of a type for code generation This allows generators to work with parsed type information instead of string parsing
Variants§
Primitive(String)
Primitive types: “string”, “number”, “boolean”, “void”
Array(Box<TypeStructure>)
Array/Vec types: Vec<T> -> Array(T)
Map
Map types: HashMap<K, V>, BTreeMap<K, V> -> Map { key: K, value: V }
Set(Box<TypeStructure>)
Set types: HashSet<T>, BTreeSet<T> -> Set(T)
Tuple(Vec<TypeStructure>)
Tuple types: (T, U, V) -> Tuple([T, U, V])
Optional(Box<TypeStructure>)
Optional types: Option<T> -> Optional(T)
Result(Box<TypeStructure>)
Result types: Result<T, E> -> Result(T) (error type ignored for TS)
Custom(String)
Custom/User-defined types
Trait Implementations§
Source§impl Clone for TypeStructure
impl Clone for TypeStructure
Source§fn clone(&self) -> TypeStructure
fn clone(&self) -> TypeStructure
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 TypeStructure
impl Debug for TypeStructure
Source§impl Default for TypeStructure
impl Default for TypeStructure
Source§impl<'de> Deserialize<'de> for TypeStructure
impl<'de> Deserialize<'de> for TypeStructure
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
Auto Trait Implementations§
impl Freeze for TypeStructure
impl RefUnwindSafe for TypeStructure
impl Send for TypeStructure
impl Sync for TypeStructure
impl Unpin for TypeStructure
impl UnwindSafe for TypeStructure
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