macro_rules! encoder_newtype {
(
$(#[$($struct_attr:tt)*])*
$vis:vis struct $name:ident<$lt:lifetime>($encoder:ty);
) => { ... };
}Expand description
Implements a newtype around an encoder.
The new type will implement the Encoder trait by forwarding to the wrapped encoder. If your
type has a known size consider using crate::encoder_newtype_exact instead.
ยงExamples
use bitcoin_consensus_encoding::{encoder_newtype, BytesEncoder};
encoder_newtype! {
/// The encoder for the [`Foo`] type.
pub struct FooEncoder<'e>(BytesEncoder<'e>);
}For a full example see ./examples/encoder.rs.