Struct mesh_protobuf::encoding::ByteField
source · pub struct ByteField;
Expand description
A field encoder for u8.
This is separate from VarintField so that the packed format can be a byte array instead of a varint array.
Trait Implementations§
source§impl DescribeField<u8> for ByteField
impl DescribeField<u8> for ByteField
source§const FIELD_TYPE: FieldType<'static> = _
const FIELD_TYPE: FieldType<'static> = _
The type of the field.
source§const PACKED_TYPE: Option<&'static str> = _
const PACKED_TYPE: Option<&'static str> = _
The type name of the field in a packed context.
source§impl<'a, R> FieldDecode<'a, u8, R> for ByteField
impl<'a, R> FieldDecode<'a, u8, R> for ByteField
source§fn read_field(
item: &mut InplaceOption<'_, u8>,
reader: FieldReader<'_, '_, R>,
) -> Result<()>
fn read_field( item: &mut InplaceOption<'_, u8>, reader: FieldReader<'_, '_, R>, ) -> Result<()>
Reads a field into
item
.source§fn default_field(item: &mut InplaceOption<'_, u8>) -> Result<()>
fn default_field(item: &mut InplaceOption<'_, u8>) -> Result<()>
Instantiates
item
with its default value, if there is one. Read moresource§fn packed<'p, C: CopyExtend<u8>>() -> Option<&'p dyn PackedDecode<'a, u8, C>>where
u8: 'p,
fn packed<'p, C: CopyExtend<u8>>() -> Option<&'p dyn PackedDecode<'a, u8, C>>where
u8: 'p,
Unless
packed()::must_pack()
is true, the sequence decoder must detect
the encoding (packed or not) and call the appropriate method.source§fn wrap_in_sequence() -> bool
fn wrap_in_sequence() -> bool
Returns whether this field is wrapped in a message when encoded nested
in a sequence (such as a repeated field).
source§fn read_field_in_sequence(
item: &mut InplaceOption<'_, T>,
reader: FieldReader<'a, '_, R>,
) -> Result<()>
fn read_field_in_sequence( item: &mut InplaceOption<'_, T>, reader: FieldReader<'a, '_, R>, ) -> Result<()>
Reads this field that was encoded as part of a sequence, unwrapping it
from a message if necessary.
source§const ENTRY: DecoderEntry<'a, T, R> = _
const ENTRY: DecoderEntry<'a, T, R> = _
The table decoder entry for this type, used in types from
table::decode
. Read moresource§impl<R> FieldEncode<u8, R> for ByteField
impl<R> FieldEncode<u8, R> for ByteField
source§fn write_field(item: u8, writer: FieldWriter<'_, '_, R>)
fn write_field(item: u8, writer: FieldWriter<'_, '_, R>)
Writes
item
as a field.source§fn compute_field_size(item: &mut u8, sizer: FieldSizer<'_>)
fn compute_field_size(item: &mut u8, sizer: FieldSizer<'_>)
Computes the size of
item
as a field. Read moresource§fn packed<'a>() -> Option<&'a dyn PackedEncode<u8>>
fn packed<'a>() -> Option<&'a dyn PackedEncode<u8>>
Returns the encoder for writing multiple instances of this field in a
packed list, or
None
if there is no packed encoding for this type.source§fn wrap_in_sequence() -> bool
fn wrap_in_sequence() -> bool
Returns whether this field should be wrapped in a message when encoded
nested in a sequence (such as a repeated field). Read more
source§fn write_field_in_sequence(item: T, writer: &mut SequenceWriter<'_, '_, R>)
fn write_field_in_sequence(item: T, writer: &mut SequenceWriter<'_, '_, R>)
Writes this field as part of a sequence, wrapping it in a message if
necessary.
source§fn compute_field_size_in_sequence(item: &mut T, sizer: &mut SequenceSizer<'_>)
fn compute_field_size_in_sequence(item: &mut T, sizer: &mut SequenceSizer<'_>)
Computes the size of this field as part of a sequence, including the
size of a wrapping message.
source§const ENTRY: EncoderEntry<T, R> = _
const ENTRY: EncoderEntry<T, R> = _
The table encoder entry for this type, used in types from
table::encode
. Read moresource§impl<C: CopyExtend<u8>> PackedDecode<'_, u8, C> for ByteField
impl<C: CopyExtend<u8>> PackedDecode<'_, u8, C> for ByteField
source§impl PackedEncode<u8> for ByteField
impl PackedEncode<u8> for ByteField
source§fn write_packed(&self, data: &[u8], writer: PackedWriter<'_, '_>)
fn write_packed(&self, data: &[u8], writer: PackedWriter<'_, '_>)
Writes a slice of data in packed format.
source§fn compute_packed_size(&self, data: &[u8], sizer: PackedSizer<'_>)
fn compute_packed_size(&self, data: &[u8], sizer: PackedSizer<'_>)
Computes the size of the data in packed format.
Auto Trait Implementations§
impl Freeze for ByteField
impl RefUnwindSafe for ByteField
impl Send for ByteField
impl Sync for ByteField
impl Unpin for ByteField
impl UnwindSafe for ByteField
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