Expand description
Functions and structures to handle and manipulate generic parameters using the syn crate. It’s designed to support macro-driven code generation by simplifying, merging, extracting, and decomposing syn::Generics.
Re-exports§
pub use super::super::generic_params;
Modules§
- classification
- Generic parameter classification utilities.
- combine
- Generic parameter combination and merging utilities.
- exposed
- Exposed namespace of the module.
- filter
- Generic parameter filtering utilities.
- orphan
- Orphan namespace of the module.
- own
- Own namespace of the module.
- prelude
- Prelude to use essentials:
use my_module::prelude::*.
Structs§
- Decomposed
Classified - Extended decomposition result that includes classification and pre-filtered common cases.
- Generics
Classification - Classification of generic parameters by their type.
- Generics
Ref - A wrapper around a reference to
syn::Genericsto provide convenient helper methods for generating token streams related to generic parameters. - Generics
With Where - A
GenericsWithWherestruct to handle the parsing of Rust generics with an explicitwhereclause.
Functions§
- classify_
generics - Classify generic parameters by their type.
- decompose
- Decomposes
syn::Genericsinto components suitable for different usage contexts in Rust implementations, specifically focusing on different requirements forimplblocks and type definitions. - decompose_
classified - Extended decompose that provides classified parameters.
- filter_
consts - Predicate to filter only const parameters.
- filter_
lifetimes - Predicate to filter only lifetime parameters.
- filter_
non_ lifetimes - Predicate to filter out lifetime parameters (keeping types and consts).
- filter_
params - Filter generic parameters based on a predicate.
- filter_
types - Predicate to filter only type parameters.
- merge
- Merges two
syn::Genericsinstances into a new one. - merge_
params_ ordered - Merge multiple parameter lists maintaining proper order (lifetimes, types, consts).
- names
- Extracts the names of type parameters, lifetimes, and const parameters from the given
Generics. - only_
names - Extracts parameter names from the given
Generics, dropping bounds, defaults, and the where clause. - params_
from_ components - Create a new parameter list from individual components.
- params_
with_ additional - Add parameters to existing list with smart comma handling.