aboutsummaryrefslogtreecommitdiff
path: root/src/transform.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transform.rs')
-rw-r--r--src/transform.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/transform.rs b/src/transform.rs
index ec2f3a6..39b32cc 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -6,13 +6,14 @@ use syn::{
};
use crate::{
+ parse_assoc_type::DestType,
parse_trait_sig::{MethodParseError, TypeTransform},
syn_utils::{find_in_path, find_in_type},
As, AssocTypeMatcher,
};
#[derive(Default)]
-pub struct AssocTypeConversions<'a>(pub HashMap<Ident, &'a Type>);
+pub struct AssocTypeConversions<'a>(pub HashMap<Ident, DestType<'a>>);
pub enum TransformError {
UnconvertibleAssocType(Span),
@@ -34,12 +35,12 @@ impl AssocTypeConversions<'_> {
if ident == "Self" && path.segments.len() == 2 {
let ident = &path.segments.last().unwrap().ident;
- *type_ = (*self
+ let dest_type = self
.0
.get(ident)
- .ok_or_else(|| TransformError::UnconvertibleAssocType(ident.span()))?)
- .clone();
- return Ok(TypeTransform::Into);
+ .ok_or_else(|| TransformError::UnconvertibleAssocType(ident.span()))?;
+ *type_ = dest_type.get_dest();
+ return Ok(dest_type.type_transformation());
} else if ident == "Option" && path.segments.len() == 1 {
let first_seg = path.segments.first_mut().unwrap();