Struct FieldSizer
pub struct FieldSizer<'a> { /* private fields */ }
Expand description
Type used to compute the size of field values.
Implementations§
§impl<'a> FieldSizer<'a>
impl<'a> FieldSizer<'a>
pub fn sequence(self) -> SequenceSizer<'a>
pub fn sequence(self) -> SequenceSizer<'a>
Returns a sequence sizer for sizing the field multiple times.
Panics if called while already sizing a sequence, since this would result in an invalid protobuf message.
pub fn write_empty(&self) -> bool
pub fn write_empty(&self) -> bool
If true, encoders must write their fields even if they are empty.
pub fn message<F>(self, f: F)where
F: FnOnce(MessageSizer<'_>),
pub fn message<F>(self, f: F)where
F: FnOnce(MessageSizer<'_>),
Computes the size for a message. Calls f
with a MessageSizer
to
calculate the size of each field.
pub fn resource(self)
pub fn resource(self)
Computes the size for a resource.
pub fn packed<F>(self, f: F)where
F: FnOnce(PackedSizer<'_>),
pub fn packed<F>(self, f: F)where
F: FnOnce(PackedSizer<'_>),
Computes the size of a packed value. Calls f
with a PackedSizer
to
sum the size of each element.
Auto Trait Implementations§
impl<'a> Freeze for FieldSizer<'a>
impl<'a> RefUnwindSafe for FieldSizer<'a>
impl<'a> Send for FieldSizer<'a>
impl<'a> Sync for FieldSizer<'a>
impl<'a> Unpin for FieldSizer<'a>
impl<'a> !UnwindSafe for FieldSizer<'a>
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