pub struct DynamicMessage<'pool, 'msg> { /* private fields */ }Expand description
Mutable view of a protobuf message for dynamic modification.
Extends DynamicMessageRef with mutation capabilities. Use for decoding
messages or setting field values dynamically.
Implements Deref<Target = DynamicMessageRef> so all read methods are available.
Implementations§
Source§impl<'pool, 'msg> DynamicMessage<'pool, 'msg>
impl<'pool, 'msg> DynamicMessage<'pool, 'msg>
pub fn as_ref<'a>(&'a self) -> DynamicMessageRef<'pool, 'a>
Methods from Deref<Target = DynamicMessageRef<'pool, 'msg>>§
pub fn descriptor(&self) -> &'pool DescriptorProto
pub fn find_field_descriptor( &self, field_name: &str, ) -> Option<&'pool FieldDescriptorProto>
pub fn find_field_descriptor_by_number( &self, field_number: i32, ) -> Option<&'pool FieldDescriptorProto>
pub fn get_field( &self, field: &'pool FieldDescriptorProto, ) -> Option<Value<'pool, 'msg>>
Trait Implementations§
Source§impl<'pool, 'msg> Debug for DynamicMessage<'pool, 'msg>
impl<'pool, 'msg> Debug for DynamicMessage<'pool, 'msg>
Source§impl<'pool, 'msg> Deref for DynamicMessage<'pool, 'msg>
impl<'pool, 'msg> Deref for DynamicMessage<'pool, 'msg>
Source§impl<'pool, 'msg> From<DynamicMessage<'pool, 'msg>> for DynamicMessageRef<'pool, 'msg>
impl<'pool, 'msg> From<DynamicMessage<'pool, 'msg>> for DynamicMessageRef<'pool, 'msg>
Source§fn from(dynamic: DynamicMessage<'pool, 'msg>) -> Self
fn from(dynamic: DynamicMessage<'pool, 'msg>) -> Self
Converts to this type from the input type.
Source§impl<'pool, 'msg> ProtobufMut<'pool> for DynamicMessage<'pool, 'msg>
impl<'pool, 'msg> ProtobufMut<'pool> for DynamicMessage<'pool, 'msg>
Source§fn as_dyn_mut<'a>(&'a mut self) -> DynamicMessage<'pool, 'a>
fn as_dyn_mut<'a>(&'a mut self) -> DynamicMessage<'pool, 'a>
Get a mutable dynamic view of this message.
Source§fn decode_flat<const STACK_DEPTH: usize>(
&mut self,
arena: &mut Arena<'_>,
buf: &[u8],
) -> bool
fn decode_flat<const STACK_DEPTH: usize>( &mut self, arena: &mut Arena<'_>, buf: &[u8], ) -> bool
Decode from a byte slice. Returns true on success.
fn decode<'a, E>( &mut self, arena: &mut Arena<'_>, provider: &'a mut impl FnMut() -> Result<Option<&'a [u8]>, E>, ) -> Result<(), Error<E>>
fn async_decode<'a, E, F>( &'a mut self, arena: &mut Arena<'_>, provider: &'a mut impl FnMut() -> F, ) -> impl Future<Output = Result<(), Error<E>>>
fn decode_from_bufread<const STACK_DEPTH: usize>( &mut self, arena: &mut Arena<'_>, reader: &mut impl BufRead, ) -> Result<(), Error<Error>>
fn decode_from_read<const STACK_DEPTH: usize>( &mut self, arena: &mut Arena<'_>, reader: &mut impl Read, ) -> Result<(), Error<Error>>
fn decode_from_async_bufread<'a, const STACK_DEPTH: usize>( &'a mut self, arena: &'a mut Arena<'a>, reader: &mut (impl AsyncBufRead + Unpin), ) -> impl Future<Output = Result<(), Error<Error>>>
fn decode_from_async_read<'a, const STACK_DEPTH: usize>( &'a mut self, arena: &'a mut Arena<'a>, reader: &mut (impl AsyncRead + Unpin), ) -> impl Future<Output = Result<(), Error<Error>>>
fn serde_deserialize<'arena, 'alloc, 'de, D>(
&'de mut self,
arena: &'arena mut Arena<'alloc>,
deserializer: D,
) -> Result<(), D::Error>where
D: Deserializer<'de>,
Source§impl<'pool, 'msg> ProtobufRef<'pool> for DynamicMessage<'pool, 'msg>
impl<'pool, 'msg> ProtobufRef<'pool> for DynamicMessage<'pool, 'msg>
Source§fn as_dyn<'a>(&'a self) -> DynamicMessageRef<'pool, 'a>
fn as_dyn<'a>(&'a self) -> DynamicMessageRef<'pool, 'a>
Get a dynamic view of this message for reflection.
Source§fn descriptor(&self) -> &'pool ProtoType
fn descriptor(&self) -> &'pool ProtoType
Get the message’s descriptor (schema metadata).
Auto Trait Implementations§
impl<'pool, 'msg> !UnwindSafe for DynamicMessage<'pool, 'msg>
impl<'pool, 'msg> Freeze for DynamicMessage<'pool, 'msg>
impl<'pool, 'msg> RefUnwindSafe for DynamicMessage<'pool, 'msg>
impl<'pool, 'msg> Send for DynamicMessage<'pool, 'msg>
impl<'pool, 'msg> Sync for DynamicMessage<'pool, 'msg>
impl<'pool, 'msg> Unpin for DynamicMessage<'pool, 'msg>
impl<'pool, 'msg> UnsafeUnpin for DynamicMessage<'pool, 'msg>
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