Module generic_params

Source
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§

DecomposedClassified
Extended decomposition result that includes classification and pre-filtered common cases.
GenericsClassification
Classification of generic parameters by their type.
GenericsRef
A wrapper around a reference to syn::Generics to provide convenient helper methods for generating token streams related to generic parameters.
GenericsWithWhere
A GenericsWithWhere struct to handle the parsing of Rust generics with an explicit where clause.

Functions§

classify_generics
Classify generic parameters by their type.
decompose
Decomposes syn::Generics into components suitable for different usage contexts in Rust implementations, specifically focusing on different requirements for impl blocks 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::Generics instances 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.