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

pub(crate) enum Type {
Show variants ResolvedPath { path: Path, param_names: Option<Vec<GenericBound>>, did: DefId, is_generic: bool, }, 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).

Show fields

Fields of ResolvedPath

path: Pathparam_names: Option<Vec<GenericBound>>did: DefIdis_generic: bool

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

Generic(Symbol)

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

Primitive(PrimitiveType)

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

BareFunction(Box<BareFunctionDecl>)

extern "ABI" fn

Tuple(Vec<Type>)
Slice(Box<Type>)
Array(Box<Type>, String)

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

Never
RawPointer(Mutability, Box<Type>)
BorrowedRef
Show fields

Fields of BorrowedRef

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

Fields of QPath

name: Symbolself_type: Box<Type>self_def_id: Option<DefId>trait_: Box<Type>
Infer
ImplTrait(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: 96 bytes