pub struct DynamicMessage { /* private fields */ }Expand description
A looking_glass representation of a ProtocolBuffer message.
DynamicMessage allows users to create and read ProtocolBuffer messages at runtime. A DynamicMessage is created from a MessageView, but unlike a MessageView it owns its data.
This means that DynamicMessages can be modified and re-encoded. In the name of efficiency string and byte, types are reference counted from their source.
Implementations§
Source§impl DynamicMessage
impl DynamicMessage
Sourcepub fn new<T: Tranche>(view: &MessageView<T>) -> Result<DynamicMessage, Error>
pub fn new<T: Tranche>(view: &MessageView<T>) -> Result<DynamicMessage, Error>
Builds a new DynamicMessage from a MessageView.
Sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
The length of the mesage once encoded
Sourcepub fn encode(&self, buf: &mut impl BufMut)
pub fn encode(&self, buf: &mut impl BufMut)
Encoded a DynamicMessage to the passed buffer
pub fn descriptor_name(&self) -> String
pub fn descriptor_database(&self) -> Arc<DescriptorDatabase>
Trait Implementations§
Source§impl Clone for DynamicMessage
impl Clone for DynamicMessage
Source§fn clone(&self) -> DynamicMessage
fn clone(&self) -> DynamicMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DynamicMessage
impl Debug for DynamicMessage
Source§impl Instance<'static> for DynamicMessage
impl Instance<'static> for DynamicMessage
Source§impl PartialEq for DynamicMessage
impl PartialEq for DynamicMessage
Source§impl StructInstance<'static> for DynamicMessage
impl StructInstance<'static> for DynamicMessage
Source§fn get_value<'a>(&'a self, field: &str) -> Option<CowValue<'a, 'static>>where
'static: 'a,
fn get_value<'a>(&'a self, field: &str) -> Option<CowValue<'a, 'static>>where
'static: 'a,
Returns a reference to a field in a struct
Source§fn update<'a>(
&'a mut self,
update: &'a (dyn StructInstance<'static> + 'static),
field_mask: Option<&FieldMask>,
replace_repeated: bool,
) -> Result<(), Error>
fn update<'a>( &'a mut self, update: &'a (dyn StructInstance<'static> + 'static), field_mask: Option<&FieldMask>, replace_repeated: bool, ) -> Result<(), Error>
Updates an instance based on the instance passed in. If a field mask is specified only the fields passed with the mask will be updated.
Source§fn values<'a>(&'a self) -> HashMap<SmolStr, CowValue<'a, 'static>>
fn values<'a>(&'a self) -> HashMap<SmolStr, CowValue<'a, 'static>>
Returns a HashMap containing all the attributes of the instance.
Source§fn boxed_clone(&self) -> Box<dyn StructInstance<'static> + 'static>
fn boxed_clone(&self) -> Box<dyn StructInstance<'static> + 'static>
Returns a clone of the instance in a
Box.Source§impl Typed<'static> for DynamicMessage
impl Typed<'static> for DynamicMessage
impl StructuralPartialEq for DynamicMessage
Auto Trait Implementations§
impl Freeze for DynamicMessage
impl !RefUnwindSafe for DynamicMessage
impl Send for DynamicMessage
impl Sync for DynamicMessage
impl Unpin for DynamicMessage
impl !UnwindSafe for DynamicMessage
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