Trait darling_core::usage::UsesTypeParams
source · pub trait UsesTypeParams {
// Required method
fn uses_type_params<'a>(
&self,
options: &Options,
type_set: &'a IdentSet
) -> IdentRefSet<'a>;
// Provided method
fn uses_type_params_cloned(
&self,
options: &Options,
type_set: &IdentSet
) -> IdentSet { ... }
}
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§
sourcefn uses_type_params<'a>(
&self,
options: &Options,
type_set: &'a IdentSet
) -> IdentRefSet<'a>
fn uses_type_params<'a>( &self, options: &Options, type_set: &'a IdentSet ) -> IdentRefSet<'a>
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§
sourcefn uses_type_params_cloned(
&self,
options: &Options,
type_set: &IdentSet
) -> IdentSet
fn uses_type_params_cloned( &self, options: &Options, type_set: &IdentSet ) -> IdentSet
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 TypeTuple
impl UsesTypeParams for TypeTuple
fn uses_type_params<'gen>( &self, options: &Options, type_set: &'gen IdentSet ) -> IdentRefSet<'gen>
source§impl UsesTypeParams for TraitBound
impl UsesTypeParams for TraitBound
fn uses_type_params<'gen>( &self, options: &Options, type_set: &'gen IdentSet ) -> IdentRefSet<'gen>
source§impl UsesTypeParams for Variant
impl UsesTypeParams for Variant
fn uses_type_params<'gen>( &self, options: &Options, type_set: &'gen IdentSet ) -> IdentRefSet<'gen>
source§impl UsesTypeParams for PathArguments
impl UsesTypeParams for PathArguments
fn uses_type_params<'a>( &self, options: &Options, type_set: &'a IdentSet ) -> IdentRefSet<'a>
source§impl UsesTypeParams for Constraint
impl UsesTypeParams for Constraint
fn uses_type_params<'gen>( &self, options: &Options, type_set: &'gen IdentSet ) -> IdentRefSet<'gen>
source§impl UsesTypeParams for ()
impl UsesTypeParams for ()
fn uses_type_params<'a>( &self, _options: &Options, _type_set: &'a IdentSet ) -> IdentRefSet<'a>
source§impl UsesTypeParams for TypePath
impl UsesTypeParams for TypePath
fn uses_type_params<'a>( &self, options: &Options, type_set: &'a IdentSet ) -> IdentRefSet<'a>
source§impl UsesTypeParams for BareFnArg
impl UsesTypeParams for BareFnArg
fn uses_type_params<'gen>( &self, options: &Options, type_set: &'gen IdentSet ) -> IdentRefSet<'gen>
source§impl UsesTypeParams for Ident
impl UsesTypeParams for Ident
Check if an Ident exactly matches one of the sought-after type parameters.