pub struct ProtoEncoder { /* private fields */ }Expand description
Builds a protobuf-compatible binary message field by field.
Implementations§
Source§impl ProtoEncoder
impl ProtoEncoder
pub fn new() -> Self
pub fn with_capacity(cap: usize) -> Self
pub fn uint64(self, field: u32, value: u64) -> Self
pub fn uint32(self, field: u32, value: u32) -> Self
pub fn int64(self, field: u32, value: i64) -> Self
pub fn int32(self, field: u32, value: i32) -> Self
pub fn sint64(self, field: u32, value: i64) -> Self
pub fn sint32(self, field: u32, value: i32) -> Self
pub fn bool(self, field: u32, value: bool) -> Self
pub fn bytes(self, field: u32, value: &[u8]) -> Self
pub fn string(self, field: u32, value: &str) -> Self
Sourcepub fn message(self, field: u32, msg: &ProtoEncoder) -> Self
pub fn message(self, field: u32, msg: &ProtoEncoder) -> Self
Embed a sub-message (another ProtoEncoder’s output).
pub fn fixed64(self, field: u32, value: u64) -> Self
pub fn sfixed64(self, field: u32, value: i64) -> Self
pub fn double(self, field: u32, value: f64) -> Self
pub fn fixed32(self, field: u32, value: u32) -> Self
pub fn sfixed32(self, field: u32, value: i32) -> Self
pub fn float(self, field: u32, value: f32) -> Self
pub fn as_bytes(&self) -> &[u8] ⓘ
pub fn finish(self) -> Vec<u8> ⓘ
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProtoEncoder
impl RefUnwindSafe for ProtoEncoder
impl Send for ProtoEncoder
impl Sync for ProtoEncoder
impl Unpin for ProtoEncoder
impl UnsafeUnpin for ProtoEncoder
impl UnwindSafe for ProtoEncoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more