muta-protocol 0.1.0-alpha.1

Contains all the core data types and traits of the muta framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#[macro_export]
macro_rules! impl_default_fixed_codec_for {
    ($category:ident, [$($type:ident),+]) => (
        use crate::types::$category;

        $(
            impl FixedCodec for $category::$type {
                fn encode_fixed(&self) -> ProtocolResult<bytes::Bytes> {
                    Ok(bytes::Bytes::from(rlp::encode(self)))
                }

                fn decode_fixed(bytes: bytes::Bytes) -> ProtocolResult<Self> {
                    Ok(rlp::decode(bytes.as_ref()).map_err(FixedCodecError::from)?)
                }
            }
        )+
    )
}