## CrateDefType

# Trait CrateDefType

Source

    pub trait CrateDefType: CrateDef {
        // Provided methods
        fn ty(&self) -> Ty { ... }
        fn ty_with_args(&self, args: &GenericArgs) -> Ty { ... }
    }

Expand description

A trait that can be used to retrieve a definition’s type.

Note that not every CrateDef has a type `Ty`. They should not implement this trait.

## Provided Methods§

Source

#### fn ty(&self) -> Ty

Returns the type of this crate item.

Source

#### fn ty_with_args(&self, args: &GenericArgs) -> Ty

Retrieve the type of this definition by instantiating and normalizing it with `args`.

This will panic if instantiation fails.

## Implementors§

Source§

### impl CrateDefType for CrateItem

Source§

### impl CrateDefType for ConstDef

Source§

### impl CrateDefType for FnDef

Source§

### impl CrateDefType for ForeignDef

Source§

### impl CrateDefType for IntrinsicDef