Skip to main content

BuffaEncodeField

Trait BuffaEncodeField 

Source
pub trait BuffaEncodeField {
    // Required method
    fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut);
}
Expand description

Encode a single struct field as a buffa wire-format tag + value pair, using proto3’s “skip default” semantics.

One impl per supported scalar type. The derive macro emits one self.field.buffa_encode_field(N, buf) call per field; the trait dispatch picks the right wire-format helper at compile time, so the macro does not need to introspect the field’s syntactic type.

Required Methods§

Source

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Encode self under proto field number number. Implementations must skip emitting any bytes when self equals the proto3 default for the type (empty string, zero integer, false, …) so the wire shape matches buffa::Message::write_to.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl BuffaEncodeField for &str

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl BuffaEncodeField for &[u8]

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl BuffaEncodeField for bool

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl BuffaEncodeField for f32

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl BuffaEncodeField for f64

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl BuffaEncodeField for i32

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl BuffaEncodeField for i64

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl BuffaEncodeField for u32

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl BuffaEncodeField for u64

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl BuffaEncodeField for String

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl BuffaEncodeField for Vec<u8>

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl BuffaEncodeField for SecretBox<str>

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl BuffaEncodeField for SecretBox<Vec<u8>>

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Source§

impl<T> BuffaEncodeField for Option<T>

Source§

fn buffa_encode_field(&self, number: u32, buf: &mut BytesMut)

Implementors§