diff --git a/derive/src/decode.rs b/derive/src/decode.rs index 18de4463..5c1441bf 100644 --- a/derive/src/decode.rs +++ b/derive/src/decode.rs @@ -78,7 +78,7 @@ fn create_decode_expr(field: &Field, input: &TokenStream) -> TokenStream { if compact { let field_type = &field.ty; quote_spanned! { field.span() => - <_parity_codec::Compact<#field_type> as _parity_codec::Decode>::decode(#input)?.into() + <<#field_type as _parity_codec::HasCompact>::Type as _parity_codec::Decode>::decode(#input)?.into() } } else if let Some(encoded_as) = encoded_as { quote_spanned! { field.span() => diff --git a/derive/src/encode.rs b/derive/src/encode.rs index 308a12ac..3ec5a5ff 100644 --- a/derive/src/encode.rs +++ b/derive/src/encode.rs @@ -46,7 +46,12 @@ fn encode_fields( if compact { let field_type = &f.ty; quote_spanned! { - f.span() => { #dest.push(&_parity_codec::Compact::<#field_type>::from(#field)); } + f.span() => { + #dest.push( + &<<#field_type as _parity_codec::HasCompact>::Type as + _parity_codec::EncodeAsRef<#field_type>>::RefType::from(#field) + ); + } } } else if let Some(encoded_as) = encoded_as { let field_type = &f.ty;