Enum rustdoc::clean::types::Type[−][src]

pub(crate) enum Type {
Show 14 variants ResolvedPath { path: Path, did: DefId, is_generic: bool, }, DynTrait(Vec<PolyTrait>, Option<Lifetime>), Generic(Symbol), Primitive(PrimitiveType), BareFunction(Box<BareFunctionDecl>), Tuple(Vec<Type>), Slice(Box<Type>), Array(Box<Type>, String), Never, 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_: Box<Type>, }, Infer, ImplTrait(Vec<GenericBound>),
}
Expand description

A representation of a type suitable for hyperlinking purposes. Ideally, one can get the original type out of the AST/TyCtxt given one of these, if more information is needed. Most importantly, it does not preserve mutability or boxes.

Variants

ResolvedPath

Structs/enums/traits (most that would be an hir::TyKind::Path).

Fields of ResolvedPath

path: Pathdid: DefIdis_generic: bool

true if is a T::Name path for associated types.

DynTrait

dyn for<'a> Trait<'a> + Send + 'static

Tuple Fields of DynTrait

0: Vec<PolyTrait>1: Option<Lifetime>
Generic

For parameterized types, so the consumer of the JSON don’t go looking for types which don’t exist anywhere.

Tuple Fields of Generic

0: Symbol
Primitive

Primitives are the fixed-size numeric types (plus int/usize/float), char, arrays, slices, and tuples.

Tuple Fields of Primitive

0: PrimitiveType
BareFunction

extern "ABI" fn

Tuple Fields of BareFunction

0: Box<BareFunctionDecl>
Tuple

Tuple Fields of Tuple

0: Vec<Type>
Slice

Tuple Fields of Slice

0: Box<Type>
Array

The String field is about the size or the constant representing the array’s length.

Tuple Fields of Array

0: Box<Type>1: String
Never
RawPointer

Tuple Fields of RawPointer

0: Mutability1: Box<Type>
BorrowedRef

Fields of BorrowedRef

lifetime: Option<Lifetime>mutability: Mutabilitytype_: Box<Type>
QPath

Fields of QPath

name: Symbolself_type: Box<Type>self_def_id: Option<DefId>trait_: Box<Type>
Infer
ImplTrait

Tuple Fields of ImplTrait

0: Vec<GenericBound>

Implementations

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Layout

Note: Most layout information is completely unstable and may be different between compiler versions and platforms. 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