Enum rustdoc::clean::types::Type [−][src]
pub(crate) enum Type {
Show 13 variants
ResolvedPath {
path: Path,
did: DefId,
},
DynTrait(Vec<PolyTrait>, Option<Lifetime>),
Generic(Symbol),
Primitive(PrimitiveType),
BareFunction(Box<BareFunctionDecl>),
Tuple(Vec<Type>),
Slice(Box<Type>),
Array(Box<Type>, String),
RawPointer(Mutability, Box<Type>),
BorrowedRef {
lifetime: Option<Lifetime>,
mutability: Mutability,
type_: Box<Type>,
},
QPath {
name: Symbol,
self_type: Box<Type>,
self_def_id: Option<DefId>,
trait_: Path,
},
Infer,
ImplTrait(Vec<GenericBound>),
}
Expand description
Rustdoc’s representation of types, mostly based on the hir::Ty
.
Variants
A named type, which could be a trait.
This is mostly Rustdoc’s version of hir::Path
. It has to be different because Rustdoc’s PathSegment
can contain cleaned generics.
A dyn Trait
object: dyn for<'a> Trait<'a> + Send + 'static
Generic(Symbol)
A type parameter.
Tuple Fields of Generic
0: Symbol
Primitive(PrimitiveType)
A primitive (aka, builtin) type.
Tuple Fields of Primitive
BareFunction(Box<BareFunctionDecl>)
A function pointer: extern "ABI" fn(...) -> ...
Tuple Fields of BareFunction
0: Box<BareFunctionDecl>
A tuple type: (i32, &str)
.
A slice type (does not include the &
): [i32]
An array type.
The String
field is a stringified version of the array’s length parameter.
RawPointer(Mutability, Box<Type>)
A raw pointer type: *const i32
, *mut i32
Tuple Fields of RawPointer
0: Mutability
1: Box<Type>
A reference type: &i32
, &'a mut Foo
Fields of BorrowedRef
A qualified path to an associated item: <Type as Trait>::Name
Fields of QPath
A type that is inferred: _
ImplTrait(Vec<GenericBound>)
An impl Trait
: impl TraitA + TraitB + ...
Tuple Fields of ImplTrait
0: Vec<GenericBound>
Implementations
Checks if this is a T::Name
path for an associated type.
Trait Implementations
Use this method to get the DefId
of a clean
AST node.
This will return None
when called on a primitive clean::Type
.
Use Self::def_id_full
if you want to include primitives. Read more
Use this method to get the DefId of a clean AST node, including PrimitiveTypes. Read more
Auto Trait Implementations
impl RefUnwindSafe for Type
impl UnwindSafe for Type
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
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: 72 bytes
Size for each variant:
ResolvedPath
: 63 bytesDynTrait
: 31 bytesGeneric
: 7 bytesPrimitive
: 1 byteBareFunction
: 15 bytesTuple
: 31 bytesSlice
: 15 bytesArray
: 39 bytesRawPointer
: 15 bytesBorrowedRef
: 15 bytesQPath
: 71 bytesInfer
: 0 bytesImplTrait
: 31 bytes