Struct mesh::payload::encoding::ArcEncoding
source · pub struct ArcEncoding<E>(/* private fields */);
Expand description
A wrapper encoding for reference-counted data.
If the Arc<T>
is the sole owner of T, then T is serialized as-is. If there
are other references, then the T is first cloned so that there is a single
instance.
Messages and fields are handled as if they are not reference counted, except that they are never encoded in packed format.
Trait Implementations§
source§impl<E, T> DescribeField<T> for ArcEncoding<E>where
E: DescribeField<T>,
impl<E, T> DescribeField<T> for ArcEncoding<E>where
E: DescribeField<T>,
source§const FIELD_TYPE: FieldType<'static> = E::FIELD_TYPE
const FIELD_TYPE: FieldType<'static> = E::FIELD_TYPE
The type of the field.
source§const PACKED_TYPE: Option<&'static str> = None
const PACKED_TYPE: Option<&'static str> = None
The type name of the field in a packed context.
source§impl<E, T> DescribeMessage<T> for ArcEncoding<E>where
E: DescribeMessage<T>,
impl<E, T> DescribeMessage<T> for ArcEncoding<E>where
E: DescribeMessage<T>,
source§const DESCRIPTION: MessageDescription<'static> = E::DESCRIPTION
const DESCRIPTION: MessageDescription<'static> = E::DESCRIPTION
The message description.
source§impl<'a, T, R, E> FieldDecode<'a, Arc<T>, R> for ArcEncoding<E>where
T: Clone,
E: FieldDecode<'a, T, R>,
impl<'a, T, R, E> FieldDecode<'a, Arc<T>, R> for ArcEncoding<E>where
T: Clone,
E: FieldDecode<'a, T, R>,
source§fn read_field(
item: &mut InplaceOption<'_, Arc<T>>,
reader: FieldReader<'a, '_, R>,
) -> Result<(), Error>
fn read_field( item: &mut InplaceOption<'_, Arc<T>>, reader: FieldReader<'a, '_, R>, ) -> Result<(), Error>
Reads a field into
item
.source§fn default_field(item: &mut InplaceOption<'_, Arc<T>>) -> Result<(), Error>
fn default_field(item: &mut InplaceOption<'_, Arc<T>>) -> Result<(), Error>
Instantiates
item
with its default value, if there is one. Read moresource§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 packed<'p, C>() -> Option<&'p dyn PackedDecode<'a, T, C>>where
C: CopyExtend<T>,
T: 'p,
fn packed<'p, C>() -> Option<&'p dyn PackedDecode<'a, T, C>>where
C: CopyExtend<T>,
T: 'p,
Unless
packed()::must_pack()
is true, the sequence decoder must detect
the encoding (packed or not) and call the appropriate method.source§fn read_field_in_sequence(
item: &mut InplaceOption<'_, T>,
reader: FieldReader<'a, '_, R>,
) -> Result<(), Error>
fn read_field_in_sequence( item: &mut InplaceOption<'_, T>, reader: FieldReader<'a, '_, R>, ) -> Result<(), Error>
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<T, R, E> FieldEncode<Arc<T>, R> for ArcEncoding<E>where
T: Clone,
E: FieldEncode<T, R>,
impl<T, R, E> FieldEncode<Arc<T>, R> for ArcEncoding<E>where
T: Clone,
E: FieldEncode<T, R>,
source§fn write_field(item: Arc<T>, writer: FieldWriter<'_, '_, R>)
fn write_field(item: Arc<T>, writer: FieldWriter<'_, '_, R>)
Writes
item
as a field.source§fn compute_field_size(item: &mut Arc<T>, sizer: FieldSizer<'_>)
fn compute_field_size(item: &mut Arc<T>, sizer: FieldSizer<'_>)
Computes the size of
item
as a field. Read moresource§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 packed<'a>() -> Option<&'a dyn PackedEncode<T>>where
T: 'a,
fn packed<'a>() -> Option<&'a dyn PackedEncode<T>>where
T: 'a,
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 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<'a, T, R, E> MessageDecode<'a, Arc<T>, R> for ArcEncoding<E>where
T: Clone,
E: MessageDecode<'a, T, R>,
impl<'a, T, R, E> MessageDecode<'a, Arc<T>, R> for ArcEncoding<E>where
T: Clone,
E: MessageDecode<'a, T, R>,
source§fn read_message(
item: &mut InplaceOption<'_, Arc<T>>,
reader: MessageReader<'a, '_, R>,
) -> Result<(), Error>
fn read_message( item: &mut InplaceOption<'_, Arc<T>>, reader: MessageReader<'a, '_, R>, ) -> Result<(), Error>
Reads a message into
item
.source§impl<T, R, E> MessageEncode<Arc<T>, R> for ArcEncoding<E>where
T: Clone,
E: MessageEncode<T, R>,
impl<T, R, E> MessageEncode<Arc<T>, R> for ArcEncoding<E>where
T: Clone,
E: MessageEncode<T, R>,
source§fn write_message(item: Arc<T>, writer: MessageWriter<'_, '_, R>)
fn write_message(item: Arc<T>, writer: MessageWriter<'_, '_, R>)
Writes
item
as a message.source§fn compute_message_size(item: &mut Arc<T>, sizer: MessageSizer<'_>)
fn compute_message_size(item: &mut Arc<T>, sizer: MessageSizer<'_>)
Computes the size of
item
as a message. Read moreAuto Trait Implementations§
impl<E> Freeze for ArcEncoding<E>where
E: Freeze,
impl<E> RefUnwindSafe for ArcEncoding<E>where
E: RefUnwindSafe,
impl<E> Send for ArcEncoding<E>where
E: Send,
impl<E> Sync for ArcEncoding<E>where
E: Sync,
impl<E> Unpin for ArcEncoding<E>where
E: Unpin,
impl<E> UnwindSafe for ArcEncoding<E>where
E: UnwindSafe,
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