pub enum Type {
Path {
path: Path,
generics: Option<GenericArgs>,
},
Reference {
mutable: bool,
inner: Box<Self>,
},
Array {
element: Box<Self>,
size: Box<Expr>,
},
Slice {
element: Box<Self>,
},
Tuple(Vec<Self>),
Function {
params: Vec<Self>,
return_type: Box<Self>,
},
Unit,
Never,
SelfType,
TraitObject {
trait_name: Path,
span: Span,
},
Union {
types: Vec<Self>,
span: Span,
},
}Expand description
Type annotations
Variants§
Path
Named type with optional generic arguments (i32, VecHashMap<K, V>)
Reference
Reference type (&T or &mut T)
Array
Array type ([T; N])
Slice
Slice type ([T])
Tuple(Vec<Self>)
Tuple type ((T, U, V))
Function
Function type (fn(T, U) -> V)
Unit
Unit type ()
Never
Never type !
SelfType
Self type (implicit type of self parameter in methods)
TraitObject
Trait object type (dyn Trait)
Union
Union type: i64 | f64 | String
Implementations§
Trait Implementations§
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
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