Trait mesh_protobuf::PackedEncode

source ·
pub trait PackedEncode<T> {
    // Required methods
    fn write_packed(&self, data: &[T], writer: PackedWriter<'_, '_>);
    fn compute_packed_size(&self, data: &[T], sizer: PackedSizer<'_>);
    fn must_pack(&self) -> bool;
}
Expand description

Encoder methods for writing packed fields.

Required Methods§

source

fn write_packed(&self, data: &[T], writer: PackedWriter<'_, '_>)

Writes a slice of data in packed format.

source

fn compute_packed_size(&self, data: &[T], sizer: PackedSizer<'_>)

Computes the size of the data in packed format.

source

fn must_pack(&self) -> bool

If true, when this type is encoded as part of a sequence, it cannot be encoded with a normal repeated encoding and must be packed. This is used to determine if a nested repeated sequence needs to be wrapped in a message to avoid ambiguity.

Implementors§