pub enum Type {
Show 14 variants
ResolvedPath(Path),
DynTrait(DynTrait),
Generic(String),
Primitive(String),
FunctionPointer(Box<FunctionPointer>),
Tuple(Vec<Type>),
Slice(Box<Type>),
Array {
type_: Box<Type>,
len: String,
},
Pat {
type_: Box<Type>,
/* private fields */
},
ImplTrait(Vec<GenericBound>),
Infer,
RawPointer {
is_mutable: bool,
type_: Box<Type>,
},
BorrowedRef {
lifetime: Option<String>,
is_mutable: bool,
type_: Box<Type>,
},
QualifiedPath {
name: String,
args: Box<GenericArgs>,
self_type: Box<Type>,
trait_: Option<Path>,
},
}
Expand description
A type.
Variants§
ResolvedPath(Path)
Structs, enums, unions and type aliases, e.g. std::option::Option<u32>
DynTrait(DynTrait)
Dynamic trait object type (dyn Trait
).
Generic(String)
Parameterized types. The contained string is the name of the parameter.
Primitive(String)
Built-in numeric types (e.g. u32
, f32
), bool
, char
.
FunctionPointer(Box<FunctionPointer>)
A function pointer type, e.g. fn(u32) -> u32
, extern "C" fn() -> *const u8
Tuple(Vec<Type>)
A tuple type, e.g. (String, u32, Box<usize>)
Slice(Box<Type>)
An unsized slice type, e.g. [u32]
.
Array
An array type, e.g. [u32; 15]
Fields
Pat
A pattern type, e.g. u32 is 1..
ImplTrait(Vec<GenericBound>)
An opaque type that satisfies a set of bounds, impl TraitA + TraitB + ...
Infer
A type that’s left to be inferred, _
RawPointer
A raw pointer type, e.g. *mut u32
, *const u8
, etc.
Fields
BorrowedRef
&'a mut String
, &str
, etc.
Fields
QualifiedPath
Associated types like <Type as Trait>::Name
and T::Item
where
T: Iterator
or inherent associated types like Struct::Name
.
Fields
name: String
The name of the associated type in the parent type.
<core::array::IntoIter<u32, 42> as Iterator>::Item
// ^^^^
args: Box<GenericArgs>
The generic arguments provided to the associated type.
<core::slice::IterMut<'static, u32> as BetterIterator>::Item<'static>
// ^^^^^^^^^