diff options
author | Martin Fischer <martin@push-f.com> | 2021-11-22 12:05:22 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-11-22 12:05:22 +0100 |
commit | e8581b5034c52636f4f76a8e91b57e7752323d04 (patch) | |
tree | a3dae3ef0289a2f7a28f001df6f9c7939bbe6df5 /src/syn_utils.rs | |
parent | 7384c11750e9971770683861f7cd5f719c487ce9 (diff) |
make convert_type skip non-type generics
Diffstat (limited to 'src/syn_utils.rs')
-rw-r--r-- | src/syn_utils.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/syn_utils.rs b/src/syn_utils.rs index ea4b5ea..00efee0 100644 --- a/src/syn_utils.rs +++ b/src/syn_utils.rs @@ -23,6 +23,15 @@ pub fn lifetime_bounds<T>( }) } +pub fn type_arguments_mut<P>( + args: &mut Punctuated<GenericArgument, P>, +) -> impl Iterator<Item = &mut Type> { + args.iter_mut().filter_map(|a| match a { + GenericArgument::Type(t) => Some(t), + _other => None, + }) +} + pub enum TypeOrPath<'a> { Type(&'a Type), Path(&'a Path), |