/// FIXME: this only lists trait bounds from the item defining the type
/// parameter, not additional bounds that might be added e.g. by a method if
/// the parameter comes from an impl!
this only lists trait bounds from the item defining the type
parameter, not additional bounds that might be added e.g. by a method if
the parameter comes from an impl!
this only lists trait bounds from the item defining the type parameter not additional bounds that might be added e . g . by a method if the parameter comes from an impl!
pub fn trait_bounds(self, db: &dyn HirDatabase) -> Vec<Trait> {
        db.generic_predicates_for_param(self.id.parent(), self.id.into(), None)
            .iter()
            .filter_map(|pred| match &pred.skip_binders().skip_binders() {
                hir_ty::WhereClause::Implemented(trait_ref) => {
                    Some(Trait::from(trait_ref.hir_trait_id()))
                }
                _ => None,
            })
            .collect()
    }
pub fn trait_bounds ( self , db : & dyn HirDatabase ) -> Vec < Trait > { db . generic_predicates_for_param ( self . id . parent ( ) , self . id . into ( ) , None ) . iter ( ) . filter_map ( | pred | match & pred . skip_binders ( ) . skip_binders ( ) { hir_ty :: WhereClause :: Implemented ( trait_ref ) => { Some ( Trait :: from ( trait_ref . hir_trait_id ( ) ) ) } _ => None , } ) . collect ( ) }
FIXME: this only lists trait bounds from the item defining the type
parameter, not additional bounds that might be added e.g.
FIXME : this only lists trait bounds from the item defining the type parameter not additional bounds that might be added e . g .
self
db
&dyn HirDatabase