diff options
author | Martin Fischer <martin@push-f.com> | 2021-11-25 08:33:06 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-11-25 08:40:30 +0100 |
commit | 21583e526c8045c60026b1fe8ec9510734d1764d (patch) | |
tree | 53763ef8ff9bbc6f1288efb9c7a3ecb58afd15cc /src | |
parent | 73b1ca899858b7079bec54a6e4f29941cbb8d0bd (diff) |
rename parse_trait_sig module to trait_sig
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 12 | ||||
-rw-r--r-- | src/parse_assoc_type.rs | 2 | ||||
-rw-r--r-- | src/trait_sig.rs (renamed from src/parse_trait_sig.rs) | 34 | ||||
-rw-r--r-- | src/transform.rs | 2 |
4 files changed, 25 insertions, 25 deletions
@@ -44,18 +44,18 @@ use syn_utils::TypeOrPath; use crate::parse_assoc_type::parse_assoc_type; use crate::parse_assoc_type::AssocTypeError; -use crate::parse_trait_sig::parse_trait_signature; -use crate::parse_trait_sig::MethodError; -use crate::parse_trait_sig::SignatureChanges; -use crate::parse_trait_sig::TypeTransform; use crate::syn_utils::iter_path; use crate::syn_utils::trait_bounds; +use crate::trait_sig::convert_trait_signature; +use crate::trait_sig::MethodError; +use crate::trait_sig::SignatureChanges; +use crate::trait_sig::TypeTransform; use crate::transform::TransformError; use crate::transform::TypeConverter; mod parse_assoc_type; -mod parse_trait_sig; mod syn_utils; +mod trait_sig; mod transform; macro_rules! abort { @@ -189,7 +189,7 @@ pub fn dynamize(_attr: TokenStream, input: TokenStream) -> TokenStream { for item in &original_trait.items { if let TraitItem::Method(method) = item { let mut signature = method.sig.clone(); - match parse_trait_signature(&mut signature, &type_converter) { + match convert_trait_signature(&mut signature, &type_converter) { Ok(parsed_method) => objectifiable_methods.push((signature, parsed_method)), Err((span, err)) => match err { MethodError::NonDispatchableMethod => continue, diff --git a/src/parse_assoc_type.rs b/src/parse_assoc_type.rs index a02e06c..adde237 100644 --- a/src/parse_assoc_type.rs +++ b/src/parse_assoc_type.rs @@ -4,8 +4,8 @@ use syn::spanned::Spanned; use syn::{GenericArgument, Ident, PathArguments, PathSegment, TraitItemType, Type}; use crate::match_assoc_type; -use crate::parse_trait_sig::TypeTransform; use crate::syn_utils::{iter_type, lifetime_bounds, trait_bounds}; +use crate::trait_sig::TypeTransform; #[derive(Debug)] pub enum AssocTypeError { diff --git a/src/parse_trait_sig.rs b/src/trait_sig.rs index 1267707..88aac6a 100644 --- a/src/parse_trait_sig.rs +++ b/src/trait_sig.rs @@ -52,7 +52,7 @@ pub struct SignatureChanges { pub type_param_transforms: HashMap<Ident, Vec<TypeTransform>>, } -pub fn parse_trait_signature( +pub fn convert_trait_signature( signature: &mut Signature, type_converter: &TypeConverter, ) -> Result<SignatureChanges, (Span, MethodError)> { @@ -145,7 +145,7 @@ mod tests { use crate::{ parse_assoc_type::DestType, - parse_trait_sig::{parse_trait_signature, MethodError, SignatureChanges, TypeTransform}, + trait_sig::{convert_trait_signature, MethodError, SignatureChanges, TypeTransform}, transform::{TransformError, TypeConverter}, }; @@ -157,7 +157,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Ok(SignatureChanges { return_type: TypeTransform::NoOp, .. @@ -179,7 +179,7 @@ mod tests { type_converter.assoc_type_conversions.insert(ident, dest); assert!(matches!( - parse_trait_signature(&mut type1.sig, &type_converter), + convert_trait_signature(&mut type1.sig, &type_converter), Ok(SignatureChanges { return_type: TypeTransform::Into, .. @@ -195,7 +195,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err(( _, MethodError::Transform(TransformError::AssocTypeWithoutDestType) @@ -211,7 +211,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err((_, MethodError::NonDispatchableMethod)) )); } @@ -224,7 +224,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err((_, MethodError::NonDispatchableMethod)) )); } @@ -237,7 +237,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err((_, MethodError::NonDispatchableMethod)) )); } @@ -250,7 +250,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err((_, MethodError::NonDispatchableMethod)) )); } @@ -263,7 +263,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err((_, MethodError::Transform(TransformError::UnsupportedType))) )); } @@ -276,7 +276,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err((_, MethodError::Transform(TransformError::UnsupportedType))) )); } @@ -289,7 +289,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err((_, MethodError::Transform(TransformError::UnsupportedType))) )); } @@ -302,7 +302,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err((_, MethodError::Transform(TransformError::UnsupportedType))) )); } @@ -315,7 +315,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err((_, MethodError::AssocTypeInInputs)) )); } @@ -328,7 +328,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err((_, MethodError::AssocTypeInInputs)) )); } @@ -341,7 +341,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err((_, MethodError::ImplTraitInInputs)) )); } @@ -354,7 +354,7 @@ mod tests { .unwrap(); assert!(matches!( - parse_trait_signature(&mut type1.sig, &Default::default()), + convert_trait_signature(&mut type1.sig, &Default::default()), Err((_, MethodError::Transform(TransformError::UnsupportedType))) )); } diff --git a/src/transform.rs b/src/transform.rs index 594d383..831fb14 100644 --- a/src/transform.rs +++ b/src/transform.rs @@ -10,9 +10,9 @@ use syn::{ use crate::{ filter_map_assoc_paths, match_assoc_type, parse_assoc_type::{BoxType, DestType}, - parse_trait_sig::{MethodError, TypeTransform}, path_is_assoc_type, syn_utils::{iter_path, iter_type, type_arguments_mut}, + trait_sig::{MethodError, TypeTransform}, }; #[derive(Default)] |