diff options
Diffstat (limited to 'src/trait_sig.rs')
-rw-r--r-- | src/trait_sig.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/trait_sig.rs b/src/trait_sig.rs index 5d8eddf..a1be44f 100644 --- a/src/trait_sig.rs +++ b/src/trait_sig.rs @@ -1,4 +1,5 @@ use std::collections::HashMap; +use std::rc::Rc; use proc_macro2::Span; use syn::{ @@ -8,6 +9,7 @@ use syn::{Ident, Signature, TypeImplTrait}; use crate::match_assoc_type; use crate::parse_assoc_type::BoxType; +use crate::parse_attrs::Convert; use crate::syn_utils::{iter_type, trait_bounds}; use crate::transform::{dynamize_function_bounds, TransformError, TypeConverter}; @@ -21,6 +23,7 @@ pub enum TypeTransform { IntoIterMapCollect(Vec<TypeTransform>), Iterator(BoxType, Box<TypeTransform>), Result(Box<TypeTransform>, Box<TypeTransform>), + Verbatim(Rc<Convert>), } #[derive(Debug)] @@ -83,6 +86,7 @@ pub fn convert_trait_signature( }, ReturnType::Default => TypeTransform::NoOp, }; + Ok(SignatureChanges { return_type, type_param_transforms, @@ -151,11 +155,12 @@ mod tests { transform::{TransformError, TypeConverter}, }; - fn test_converter() -> TypeConverter<'static> { + fn test_converter() -> TypeConverter { TypeConverter { assoc_type_conversions: HashMap::new(), collections: HashMap::new(), trait_ident: format_ident!("test"), + type_conversions: HashMap::new(), } } @@ -185,7 +190,7 @@ mod tests { let mut type_converter = test_converter(); let ident = format_ident!("A"); let dest_inner = Type::Verbatim(quote! {Example}); - let dest = DestType::Into(&dest_inner); + let dest = DestType::Into(dest_inner); type_converter.assoc_type_conversions.insert(ident, dest); assert!(matches!( |