darling::usage

Trait UsesTypeParams

source
pub trait UsesTypeParams {
    // Required method
    fn uses_type_params<'a>(
        &self,
        options: &Options,
        type_set: &'a HashSet<Ident, BuildHasherDefault<FnvHasher>>,
    ) -> HashSet<&'a Ident, BuildHasherDefault<FnvHasher>>;

    // Provided method
    fn uses_type_params_cloned(
        &self,
        options: &Options,
        type_set: &HashSet<Ident, BuildHasherDefault<FnvHasher>>,
    ) -> HashSet<Ident, BuildHasherDefault<FnvHasher>> { ... }
}
Expand description

Searcher for finding type params in a syntax tree. This can be used to determine if a given type parameter needs to be bounded in a generated impl.

Required Methods§

source

fn uses_type_params<'a>( &self, options: &Options, type_set: &'a HashSet<Ident, BuildHasherDefault<FnvHasher>>, ) -> HashSet<&'a Ident, BuildHasherDefault<FnvHasher>>

Returns the subset of the queried type parameters that are used by the implementing syntax element.

This method only accounts for direct usage by the element; indirect usage via bounds or where predicates are not detected.

Provided Methods§

source

fn uses_type_params_cloned( &self, options: &Options, type_set: &HashSet<Ident, BuildHasherDefault<FnvHasher>>, ) -> HashSet<Ident, BuildHasherDefault<FnvHasher>>

Find all type params using uses_type_params, then clone the found values and return the set.

Implementations on Foreign Types§

source§

impl UsesTypeParams for Fields

source§

impl UsesTypeParams for Data

source§

impl UsesTypeParams for TypeParamBound

source§

impl UsesTypeParams for WherePredicate

source§

impl UsesTypeParams for GenericArgument

source§

impl UsesTypeParams for PathArguments

source§

impl UsesTypeParams for ReturnType

source§

impl UsesTypeParams for Type

source§

impl UsesTypeParams for ()

source§

impl UsesTypeParams for Ident

Check if an Ident exactly matches one of the sought-after type parameters.

source§

impl UsesTypeParams for Field

source§

impl UsesTypeParams for FieldsNamed

source§

impl UsesTypeParams for Variant

source§

impl UsesTypeParams for DataEnum

source§

impl UsesTypeParams for DataStruct

source§

impl UsesTypeParams for DataUnion

source§

impl UsesTypeParams for PredicateType

source§

impl UsesTypeParams for TraitBound

source§

impl UsesTypeParams for AngleBracketedGenericArguments

source§

impl UsesTypeParams for AssocType

source§

impl UsesTypeParams for Constraint

source§

impl UsesTypeParams for ParenthesizedGenericArguments

source§

impl UsesTypeParams for Path

source§

impl UsesTypeParams for QSelf

source§

impl UsesTypeParams for BareFnArg

source§

impl UsesTypeParams for TypeArray

source§

impl UsesTypeParams for TypeBareFn

source§

impl UsesTypeParams for TypeGroup

source§

impl UsesTypeParams for TypeImplTrait

source§

impl UsesTypeParams for TypeParen

source§

impl UsesTypeParams for TypePath

source§

impl UsesTypeParams for TypePtr

source§

impl UsesTypeParams for TypeReference

source§

impl UsesTypeParams for TypeSlice

source§

impl UsesTypeParams for TypeTraitObject

source§

impl UsesTypeParams for TypeTuple

source§

impl<T> UsesTypeParams for Option<T>
where T: UsesTypeParams,

source§

impl<T> UsesTypeParams for Vec<T>
where T: UsesTypeParams,

source§

impl<T, U> UsesTypeParams for Punctuated<T, U>
where T: UsesTypeParams,

Implementors§

source§

impl UsesTypeParams for Ignored

source§

impl<T> UsesTypeParams for darling::ast::Fields<T>
where T: UsesTypeParams,

source§

impl<V, F> UsesTypeParams for darling::ast::Data<V, F>