diff --git a/crates/musli-common/src/macros.rs b/crates/musli-common/src/macros.rs index fe91bbc72..be6c8a324 100644 --- a/crates/musli-common/src/macros.rs +++ b/crates/musli-common/src/macros.rs @@ -94,7 +94,7 @@ macro_rules! encode_with_extensions { #[doc(hidden)] #[macro_export] macro_rules! encoding_from_slice_impls { - ($encoder_new:path, $decoder_new:path) => { + ($decoder_new:path) => { /// Decode the given type `T` from the given slice using the current /// configuration. #[inline] diff --git a/crates/musli-descriptive/src/encoding.rs b/crates/musli-descriptive/src/encoding.rs index bef3daafb..6572768f6 100644 --- a/crates/musli-descriptive/src/encoding.rs +++ b/crates/musli-descriptive/src/encoding.rs @@ -152,23 +152,8 @@ where } } - musli_common::encoding_impls! { - SelfEncoder::<_>::new, - SelfDecoder::new - } - - /// Decode the given type `T` from the given slice using the current - /// configuration. - #[inline] - pub fn from_slice<'de, T>(self, bytes: &'de [u8]) -> Result - where - T: Decode<'de, M>, - { - let alloc = musli_common::allocator::Default::default(); - let mut cx = musli_common::context::Same::new(&alloc); - let mut reader = SliceReader::new(bytes); - T::decode(&mut cx, SelfDecoder::<_>::new(&mut reader)) - } + musli_common::encoding_impls!(SelfEncoder::new, SelfDecoder::new); + musli_common::encoding_from_slice_impls!(SelfDecoder::new); } impl Clone for Encoding diff --git a/crates/musli-storage/src/encoding.rs b/crates/musli-storage/src/encoding.rs index 83c19cc1b..47b19e655 100644 --- a/crates/musli-storage/src/encoding.rs +++ b/crates/musli-storage/src/encoding.rs @@ -237,15 +237,11 @@ where } } - musli_common::encoding_impls! { - StorageEncoder::<_, I, L, Error>::new, - StorageDecoder::<_, I, L, Error>::new - } - - musli_common::encoding_from_slice_impls! { - StorageEncoder::<_, I, L, Error>::new, - StorageDecoder::<_, I, L, Error>::new - } + musli_common::encoding_impls!( + StorageEncoder::<_, I, L, _>::new, + StorageDecoder::<_, I, L, _>::new + ); + musli_common::encoding_from_slice_impls!(StorageDecoder::<_, I, L, _>::new); } impl Clone for Encoding diff --git a/crates/musli-wire/src/encoding.rs b/crates/musli-wire/src/encoding.rs index dbb51a417..361dbbe3f 100644 --- a/crates/musli-wire/src/encoding.rs +++ b/crates/musli-wire/src/encoding.rs @@ -235,15 +235,8 @@ where } } - musli_common::encoding_impls! { - WireEncoder::<_, I, L>::new, - WireDecoder::<_, I, L>::new - } - - musli_common::encoding_from_slice_impls! { - WireEncoder::<_, I, L>::new, - WireDecoder::<_, I, L>::new - } + musli_common::encoding_impls!(WireEncoder::<_, I, L>::new, WireDecoder::<_, I, L>::new); + musli_common::encoding_from_slice_impls!(WireDecoder::<_, I, L>::new); } impl Clone for Encoding