diff options
author | Martin Fischer <martin@push-f.com> | 2021-11-21 19:52:30 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-11-21 19:54:46 +0100 |
commit | 0dd8413eca378e5dc2e6cbdc6f9c6f8bde604e4a (patch) | |
tree | e191baf60e478ed040c6a865cb7676f3465860b4 /src/transform.rs | |
parent | 23fcd4ef079ad2b4aed69b4f363cbb9e7102c4ed (diff) |
support boxed Iterator in Option
Diffstat (limited to 'src/transform.rs')
-rw-r--r-- | src/transform.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/transform.rs b/src/transform.rs index fff9c6c..69929cc 100644 --- a/src/transform.rs +++ b/src/transform.rs @@ -9,7 +9,7 @@ use syn::{ use crate::{ filter_map_assoc_paths, match_assoc_type, - parse_assoc_type::DestType, + parse_assoc_type::{BoxType, DestType}, parse_trait_sig::{MethodParseError, TypeTransform}, syn_utils::{iter_path, iter_type}, }; @@ -56,8 +56,15 @@ impl AssocTypeConversions<'_> { { let inner = self.parse_type_path(&mut binding.ty)?; - *type_ = Type::Verbatim(quote! {Box<#elem + '_>}); - return Ok(TypeTransform::Iterator(inner.into())); + let box_type = BoxType { + inner: quote! {#elem}, + placeholder_lifetime: true, + }; + *type_ = Type::Verbatim(quote! {#box_type}); + return Ok(TypeTransform::Iterator( + box_type, + inner.into(), + )); } } } |