Trait DecodeMessage

Source
pub trait DecodeMessage<'m> {
    const WIRE_TYPE: WireType;

    // Required methods
    fn decode_default() -> Self;
    fn merge(
        &mut self,
        kind: FieldKind<'m>,
        is_field: bool,
    ) -> Result<(), DecodeError>;

    // Provided method
    fn parse_from_bytes(b: &'m [u8]) -> Result<Self, DecodeError>
       where Self: Sized { ... }
}

Required Associated Constants§

Source

const WIRE_TYPE: WireType

This field is just a hint, merge might accept another type

mostly this is used for detecting if we can pack a message

Required Methods§

Source

fn decode_default() -> Self

Source

fn merge( &mut self, kind: FieldKind<'m>, is_field: bool, ) -> Result<(), DecodeError>

kind does not need to be the same as Self::WIRE_TYPE

is_field is true if this message is a field of a struct or enum

Provided Methods§

Source

fn parse_from_bytes(b: &'m [u8]) -> Result<Self, DecodeError>
where Self: Sized,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'m> DecodeMessage<'m> for bool

Source§

const WIRE_TYPE: WireType = WireType::Varint

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m> DecodeMessage<'m> for f32

Source§

const WIRE_TYPE: WireType = WireType::I32

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m> DecodeMessage<'m> for f64

Source§

const WIRE_TYPE: WireType = WireType::I64

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m> DecodeMessage<'m> for i32

Source§

const WIRE_TYPE: WireType = WireType::Varint

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m> DecodeMessage<'m> for i64

Source§

const WIRE_TYPE: WireType = WireType::Varint

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m> DecodeMessage<'m> for u32

Source§

const WIRE_TYPE: WireType = WireType::Varint

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m> DecodeMessage<'m> for u64

Source§

const WIRE_TYPE: WireType = WireType::Varint

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m> DecodeMessage<'m> for String

Source§

const WIRE_TYPE: WireType = WireType::Len

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m> DecodeMessage<'m> for Vec<u8>

Source§

const WIRE_TYPE: WireType = WireType::Len

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m, A, B> DecodeMessage<'m> for (A, B)
where A: DecodeMessage<'m>, B: DecodeMessage<'m>,

Source§

const WIRE_TYPE: WireType = WireType::Len

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m, A, B, C> DecodeMessage<'m> for (A, B, C)
where A: DecodeMessage<'m>, B: DecodeMessage<'m>, C: DecodeMessage<'m>,

Source§

const WIRE_TYPE: WireType = WireType::Len

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m, A, B, C, D> DecodeMessage<'m> for (A, B, C, D)
where A: DecodeMessage<'m>, B: DecodeMessage<'m>, C: DecodeMessage<'m>, D: DecodeMessage<'m>,

Source§

const WIRE_TYPE: WireType = WireType::Len

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m, A, B, C, D, E> DecodeMessage<'m> for (A, B, C, D, E)
where A: DecodeMessage<'m>, B: DecodeMessage<'m>, C: DecodeMessage<'m>, D: DecodeMessage<'m>, E: DecodeMessage<'m>,

Source§

const WIRE_TYPE: WireType = WireType::Len

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m, A, B, C, D, E, F> DecodeMessage<'m> for (A, B, C, D, E, F)
where A: DecodeMessage<'m>, B: DecodeMessage<'m>, C: DecodeMessage<'m>, D: DecodeMessage<'m>, E: DecodeMessage<'m>, F: DecodeMessage<'m>,

Source§

const WIRE_TYPE: WireType = WireType::Len

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m, K, V> DecodeMessage<'m> for HashMap<K, V>
where K: DecodeMessage<'m> + Eq + Hash, V: DecodeMessage<'m>,

Source§

const WIRE_TYPE: WireType = WireType::Len

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m, V> DecodeMessage<'m> for Option<V>
where V: DecodeMessage<'m>,

Source§

const WIRE_TYPE: WireType = WireType::Len

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m, V> DecodeMessage<'m> for Vec<V>
where V: DecodeMessage<'m>,

Source§

const WIRE_TYPE: WireType = WireType::Len

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, is_field: bool, ) -> Result<(), DecodeError>

Source§

impl<'m, const S: usize> DecodeMessage<'m> for [u8; S]

Source§

const WIRE_TYPE: WireType = WireType::Len

Source§

fn decode_default() -> Self

Source§

fn merge( &mut self, kind: FieldKind<'m>, _is_field: bool, ) -> Result<(), DecodeError>

Implementors§

Source§

impl<'m> DecodeMessage<'m> for Fixed<i32>

Source§

const WIRE_TYPE: WireType = WireType::I32

Source§

impl<'m> DecodeMessage<'m> for Fixed<i64>

Source§

const WIRE_TYPE: WireType = WireType::I64

Source§

impl<'m> DecodeMessage<'m> for Fixed<u32>

Source§

const WIRE_TYPE: WireType = WireType::I32

Source§

impl<'m> DecodeMessage<'m> for Fixed<u64>

Source§

const WIRE_TYPE: WireType = WireType::I64

Source§

impl<'m> DecodeMessage<'m> for ZigZag<i32>

Source§

const WIRE_TYPE: WireType = WireType::Varint

Source§

impl<'m> DecodeMessage<'m> for ZigZag<i64>

Source§

const WIRE_TYPE: WireType = WireType::Varint