pub struct MessageCodec<M>(/* private fields */);Expand description
Codec for message-typed extension fields.
Singular decode merges all LengthDelimited records at the field
number (proto spec: split messages merge). Any malformed record aborts
the merge and returns None.
Trait Implementations§
Source§impl<M: Message + Default> ExtensionCodec for MessageCodec<M>
impl<M: Message + Default> ExtensionCodec for MessageCodec<M>
Source§type Value = M
type Value = M
The value type passed to
ExtensionSet::set_extension.Source§type Output = Option<M>
type Output = Option<M>
The return type of
ExtensionSet::extension.Source§fn decode(number: u32, fields: &UnknownFields) -> Option<M>
fn decode(number: u32, fields: &UnknownFields) -> Option<M>
Decode this extension’s value from the extendee’s unknown fields.
Source§fn try_encode(
number: u32,
value: M,
fields: &mut UnknownFields,
) -> Result<(), EncodeError>
fn try_encode( number: u32, value: M, fields: &mut UnknownFields, ) -> Result<(), EncodeError>
Encode
value into the extendee’s unknown fields. Read moreSource§fn encode(number: u32, value: Self::Value, fields: &mut UnknownFields)
fn encode(number: u32, value: Self::Value, fields: &mut UnknownFields)
Panicking wrapper over
try_encode. Read moreSource§impl<M: Message + Default> SingularCodec for MessageCodec<M>
impl<M: Message + Default> SingularCodec for MessageCodec<M>
type Value = M
Source§fn decode_one(data: &UnknownFieldData) -> Option<M>
fn decode_one(data: &UnknownFieldData) -> Option<M>
Decode one value from one unknown-field record’s data. Read more
Source§fn decode_one_ctx(data: &UnknownFieldData, ctx: DecodeContext<'_>) -> Option<M>
fn decode_one_ctx(data: &UnknownFieldData, ctx: DecodeContext<'_>) -> Option<M>
Decode one value under a decode context shared with the other
records of the same field. Read more
Source§fn decode_packed(_bytes: &[u8], _out: &mut Vec<M>)
fn decode_packed(_bytes: &[u8], _out: &mut Vec<M>)
Decode all values from a packed
LengthDelimited payload. Read moreSource§fn try_encode_one(value: &M) -> Result<UnknownFieldData, EncodeError>
fn try_encode_one(value: &M) -> Result<UnknownFieldData, EncodeError>
Encode one value as a single unknown-field record. Read more
Source§fn encode_one(value: &Self::Value) -> UnknownFieldData
fn encode_one(value: &Self::Value) -> UnknownFieldData
Panicking wrapper over
try_encode_one. Read moreAuto Trait Implementations§
impl<M> Forget for MessageCodec<M>
impl<M> Freeze for MessageCodec<M>
impl<M> Move for MessageCodec<M>
impl<M> RefUnwindSafe for MessageCodec<M>
impl<M> Send for MessageCodec<M>
impl<M> Sync for MessageCodec<M>
impl<M> Unpin for MessageCodec<M>
impl<M> UnsafeUnpin for MessageCodec<M>
impl<M> UnwindSafe for MessageCodec<M>
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