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>
// ^^^^^^^^^
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Type
impl<'de> Deserialize<'de> for Type
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>,
impl Eq for Type
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 80 bytes
Size for each variant:
ResolvedPath
: 48 bytesDynTrait
: 56 bytesGeneric
: 32 bytesPrimitive
: 32 bytesFunctionPointer
: 16 bytesTuple
: 32 bytesSlice
: 16 bytesArray
: 40 bytesPat
: 40 bytesImplTrait
: 32 bytesInfer
: 0 bytesRawPointer
: 24 bytesBorrowedRef
: 48 bytesQualifiedPath
: 80 bytes