Trait otopr::encoding::Encodable[][src]

pub trait Encodable {
    type Wire: WireType;
    fn encoded_size<V: VarInt>(&self, field_number: V) -> usize;
fn encode(&self, s: &mut ProtobufSerializer<impl BufMut>); fn encode_field<V: VarInt>(
        &self,
        s: &mut ProtobufSerializer<impl BufMut>,
        field_number: V
    ) { ... }
unsafe fn encode_field_precomputed(
        &self,
        s: &mut ProtobufSerializer<impl BufMut>,
        field_number: &[u8]
    ) { ... } }

Associated Types

Required methods

returns the size in bytes when encoded, including the field number.

Provided methods

The entry point to encoding Encodables in a message.

the default implementation writes field_number << 3 | wire_type as an varint and calls [encode()].

Encodes a field using precomputed bytes for the field number and the wire type varint.

Safety

You must ensure that the bytes are valid varint. That is, all bytes except the last has the MSB set.

Implementations on Foreign Types

Implementors