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§
sourcefn uses_lifetimes<'a>(
&self,
options: &Options,
lifetimes: &'a HashSet<Lifetime, BuildHasherDefault<FnvHasher>>,
) -> HashSet<&'a Lifetime, BuildHasherDefault<FnvHasher>>
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§
sourcefn uses_lifetimes_cloned(
&self,
options: &Options,
lifetimes: &HashSet<Lifetime, BuildHasherDefault<FnvHasher>>,
) -> HashSet<Lifetime, BuildHasherDefault<FnvHasher>>
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.