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

pub(crate) enum Type {
    ResolvedPath {
        path: Path,
        param_names: Option<Vec<GenericBound>>,
        did: DefId,
        is_generic: bool,
    },
    Generic(String),
    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: String,
        self_type: Box<Type>,
        trait_: Box<Type>,
    },
    Infer,
    ImplTrait(Vec<GenericBound>),
}

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: Pathparam_names: Option<Vec<GenericBound>>did: DefIdis_generic: bool

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

Generic(String)

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)
Never
RawPointer(Mutability, Box<Type>)
BorrowedRef

Fields of BorrowedRef

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

Fields of QPath

name: Stringself_type: Box<Type>trait_: Box<Type>
Infer
ImplTrait(Vec<GenericBound>)

Implementations

impl Type[src]

pub(crate) fn primitive_type(&self) -> Option<PrimitiveType>[src]

pub(crate) fn is_generic(&self) -> bool[src]

pub(crate) fn is_self_type(&self) -> bool[src]

pub(crate) fn generics(&self) -> Option<Vec<Type>>[src]

pub(crate) fn bindings(&self) -> Option<&[TypeBinding]>[src]

pub(crate) fn is_full_generic(&self) -> bool[src]

pub(crate) fn projection(&self) -> Option<(&Type, DefId, &str)>[src]

impl Type[src]

pub(crate) fn print(&self) -> impl Display + '_[src]

Trait Implementations

impl<'_, '_> Clean<Type> for (TraitRef<'_>, &'_ [TypeBinding])[src]

impl<'tcx> Clean<Type> for ProjectionTy<'tcx>[src]

impl<'_> Clean<Type> for TraitRef<'_>[src]

impl<'_> Clean<Type> for Ty<'_>[src]

impl<'tcx> Clean<Type> for Ty<'tcx>[src]

impl Clone for Type[src]

impl Debug for Type[src]

impl Eq for Type[src]

impl GetDefId for Type[src]

impl Hash for Type[src]

impl PartialEq<Type> for Type[src]

impl StructuralEq for Type[src]

impl StructuralPartialEq for Type[src]

Auto Trait Implementations

impl !RefUnwindSafe for Type

impl !Send for Type

impl !Sync for Type

impl Unpin for Type

impl !UnwindSafe for Type

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithConstness for T[src]