Skip to main content

## Clause

# Trait Clause

Source

    pub trait Clause<I>:
        Copy
        + Debug
        + Hash
        + Eq
        + TypeFoldable<I>
        + UpcastFrom<I, Binder<I, ClauseKind<I>>>
        + UpcastFrom<I, TraitRef<I>>
        + UpcastFrom<I, Binder<I, TraitRef<I>>>
        + UpcastFrom<I, TraitPredicate<I>>
        + UpcastFrom<I, Binder<I, TraitPredicate<I>>>
        + UpcastFrom<I, ProjectionPredicate<I>>
        + UpcastFrom<I, Binder<I, ProjectionPredicate<I>>>
        + IntoKind<Kind = Binder<I, ClauseKind<I>>>
        + Elaboratable<I>where
        I: Interner<Clause = Self>,{
        // Required methods
        fn as_predicate(self) -> <I as Interner>::Predicate;
        fn instantiate_supertrait(
            self,
            cx: I,
            trait_ref: Binder<I, TraitRef<I>>,
        ) -> Self;

        // Provided methods
        fn as_trait_clause(self) -> Option<Binder<I, TraitPredicate<I>>> { ... }
        fn as_host_effect_clause(self) -> Option<Binder<I, HostEffectPredicate<I>>> { ... }
        fn as_projection_clause(self) -> Option<Binder<I, ProjectionPredicate<I>>> { ... }
    }

## Required Methods§

Source

#### fn as_predicate(self) -> <I as Interner>::Predicate

Source

#### fn instantiate_supertrait( self, cx: I, trait_ref: Binder<I, TraitRef<I>>, ) -> Self

Performs a instantiation suitable for going from a poly-trait-ref to supertraits that must hold if that poly-trait-ref holds. This is slightly different from a normal instantiation in terms of what happens with bound regions.

## Provided Methods§

Source

#### fn as_trait_clause(self) -> Option<Binder<I, TraitPredicate<I>>>

Source

#### fn as_host_effect_clause(self) -> Option<Binder<I, HostEffectPredicate<I>>>

Source

#### fn as_projection_clause(self) -> Option<Binder<I, ProjectionPredicate<I>>>

## Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

## Implementors§

Source§

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