AdtDef in rustc_trait_selection::infer::canonical::ir::inherent - Rust
Description: API documentation for the Rust `AdtDef` trait in crate `rustc_trait_selection`.

Skip to main content

## AdtDef

# Trait AdtDef

Source

    pub trait AdtDef<I>:
        Copy
        + Debug
        + Hash
        + Eqwhere
        I: Interner,{
        // Required methods
        fn def_id(self) -> <I as Interner>::AdtId;
        fn is_struct(self) -> bool;
        fn is_packed(self) -> bool;
        fn struct_tail_ty(
            self,
            interner: I,
        ) -> Option<EarlyBinder<I, <I as Interner>::Ty>>;
        fn is_phantom_data(self) -> bool;
        fn is_manually_drop(self) -> bool;
        fn field_representing_type_info(
            self,
            interner: I,
            args: <I as Interner>::GenericArgs,
        ) -> Option<FieldInfo<I>>;
        fn all_field_tys(
            self,
            interner: I,
        ) -> EarlyBinder<I, impl IntoIterator<Item = <I as Interner>::Ty>>;
        fn sizedness_constraint(
            self,
            interner: I,
            sizedness: SizedTraitKind,
        ) -> Option<EarlyBinder<I, <I as Interner>::Ty>>;
        fn is_fundamental(self) -> bool;
        fn destructor(self, interner: I) -> Option<AdtDestructorKind>;
    }

## Required Methods§

Source

#### fn def_id(self) -> <I as Interner>::AdtId

Source

#### fn is_struct(self) -> bool

Source

#### fn is_packed(self) -> bool

Source

#### fn struct_tail_ty( self, interner: I, ) -> Option<EarlyBinder<I, <I as Interner>::Ty>>

Returns the type of the struct tail.

Expects the `AdtDef` to be a struct. If it is not, then this will panic.

Source

#### fn is_phantom_data(self) -> bool

Source

#### fn is_manually_drop(self) -> bool

Source

#### fn field_representing_type_info( self, interner: I, args: <I as Interner>::GenericArgs, ) -> Option<FieldInfo<I>>

Source

#### fn all_field_tys( self, interner: I, ) -> EarlyBinder<I, impl IntoIterator<Item = <I as Interner>::Ty>>

Source

#### fn sizedness_constraint( self, interner: I, sizedness: SizedTraitKind, ) -> Option<EarlyBinder<I, <I as Interner>::Ty>>

Source

#### fn is_fundamental(self) -> bool

Source

#### fn destructor(self, interner: I) -> Option<AdtDestructorKind>

## Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

## Implementations on Foreign Types§

Source§

### impl<'tcx> AdtDef<TyCtxt<'tcx>> for AdtDef<'tcx>

Source§

#### fn def_id(self) -> DefId

Source§

#### fn is_struct(self) -> bool

Source§

#### fn is_packed(self) -> bool

Source§

#### fn struct_tail_ty( self, interner: TyCtxt<'tcx>, ) -> Option<EarlyBinder<TyCtxt<'tcx>, Ty<'tcx>>>

Source§

#### fn is_phantom_data(self) -> bool

Source§

#### fn is_manually_drop(self) -> bool

Source§

#### fn field_representing_type_info( self, tcx: TyCtxt<'tcx>, args: &'tcx RawList<(), GenericArg<'tcx>>, ) -> Option<FieldInfo<TyCtxt<'tcx>>>

Source§

#### fn all_field_tys( self, tcx: TyCtxt<'tcx>, ) -> EarlyBinder<TyCtxt<'tcx>, impl IntoIterator<Item = Ty<'tcx>>>

Source§

#### fn sizedness_constraint( self, tcx: TyCtxt<'tcx>, sizedness: SizedTraitKind, ) -> Option<EarlyBinder<TyCtxt<'tcx>, Ty<'tcx>>>

Source§

#### fn is_fundamental(self) -> bool

Source§

#### fn destructor(self, tcx: TyCtxt<'tcx>) -> Option<AdtDestructorKind>

## Implementors§