Trait darling::usage::UsesLifetimes

source ·
pub trait UsesLifetimes {
    // Required method
    fn uses_lifetimes<'a>(
        &self,
        options: &Options,
        lifetimes: &'a HashSet<Lifetime, BuildHasherDefault<FnvHasher>>,
    ) -> HashSet<&'a Lifetime, BuildHasherDefault<FnvHasher>>;

    // Provided method
    fn uses_lifetimes_cloned(
        &self,
        options: &Options,
        lifetimes: &HashSet<Lifetime, BuildHasherDefault<FnvHasher>>,
    ) -> HashSet<Lifetime, BuildHasherDefault<FnvHasher>> { ... }
}
Expand description

Searcher for finding lifetimes in a syntax tree. This can be used to determine which lifetimes must be emitted in generated code.

Required Methods§

source

fn uses_lifetimes<'a>( &self, options: &Options, lifetimes: &'a HashSet<Lifetime, BuildHasherDefault<FnvHasher>>, ) -> HashSet<&'a Lifetime, BuildHasherDefault<FnvHasher>>

Returns the subset of the queried lifetimes 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_lifetimes_cloned( &self, options: &Options, lifetimes: &HashSet<Lifetime, BuildHasherDefault<FnvHasher>>, ) -> HashSet<Lifetime, BuildHasherDefault<FnvHasher>>

Find all used lifetimes, then clone them and return that set.

Implementations on Foreign Types§

source§

impl UsesLifetimes for Fields

source§

impl UsesLifetimes for Data

source§

impl UsesLifetimes for GenericParam

source§

impl UsesLifetimes for TypeParamBound

source§

impl UsesLifetimes for WherePredicate

source§

impl UsesLifetimes for GenericArgument

source§

impl UsesLifetimes for PathArguments

source§

impl UsesLifetimes for ReturnType

source§

impl UsesLifetimes for Type

source§

impl UsesLifetimes for Field

source§

impl UsesLifetimes for FieldsNamed

source§

impl UsesLifetimes for Variant

source§

impl UsesLifetimes for DataEnum

source§

impl UsesLifetimes for DataStruct

source§

impl UsesLifetimes for DataUnion

source§

impl UsesLifetimes for BoundLifetimes

source§

impl UsesLifetimes for ConstParam

source§

impl UsesLifetimes for LifetimeParam

source§

impl UsesLifetimes for PredicateLifetime

source§

impl UsesLifetimes for PredicateType

source§

impl UsesLifetimes for TraitBound

source§

impl UsesLifetimes for TypeParam

source§

impl UsesLifetimes for Lifetime

source§

impl UsesLifetimes for AngleBracketedGenericArguments

source§

impl UsesLifetimes for AssocType

source§

impl UsesLifetimes for Constraint

source§

impl UsesLifetimes for ParenthesizedGenericArguments

source§

impl UsesLifetimes for Path

source§

impl UsesLifetimes for PathSegment

source§

impl UsesLifetimes for QSelf

source§

impl UsesLifetimes for BareFnArg

source§

impl UsesLifetimes for TypeArray

source§

impl UsesLifetimes for TypeBareFn

source§

impl UsesLifetimes for TypeGroup

source§

impl UsesLifetimes for TypeImplTrait

source§

impl UsesLifetimes for TypeParen

source§

impl UsesLifetimes for TypePath

source§

impl UsesLifetimes for TypePtr

source§

impl UsesLifetimes for TypeReference

source§

impl UsesLifetimes for TypeSlice

source§

impl UsesLifetimes for TypeTraitObject

source§

impl UsesLifetimes for TypeTuple

source§

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

source§

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

source§

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

Implementors§

source§

impl UsesLifetimes for Ignored

source§

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

source§

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