DynamicMessage

Struct DynamicMessage 

Source
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

Source

pub fn new<T: Tranche>(view: &MessageView<T>) -> Result<DynamicMessage, Error>

Builds a new DynamicMessage from a MessageView.

Source

pub fn encoded_len(&self) -> usize

The length of the mesage once encoded

Source

pub fn encode(&self, buf: &mut impl BufMut)

Encoded a DynamicMessage to the passed buffer

Source

pub fn descriptor_name(&self) -> String

Source

pub fn descriptor_database(&self) -> Arc<DescriptorDatabase>

Trait Implementations§

Source§

impl Clone for DynamicMessage

Source§

fn clone(&self) -> DynamicMessage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DynamicMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Instance<'static> for DynamicMessage

Source§

fn name(&self) -> SmolStr

Returns the name of a instance
Source§

fn as_inst(&self) -> &(dyn Instance<'static> + 'static)

Source§

impl PartialEq for DynamicMessage

Source§

fn eq(&self, other: &DynamicMessage) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructInstance<'static> for DynamicMessage

Source§

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>

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>>

Returns a HashMap containing all the attributes of the instance.
Source§

fn boxed_clone(&self) -> Box<dyn StructInstance<'static> + 'static>

Returns a clone of the instance in a Box.
Source§

fn into_boxed_instance(self: Box<Self>) -> Box<dyn Instance<'static> + 'static>

Casts Self to a Box<dyn Instance>
Source§

impl Typed<'static> for DynamicMessage

Source§

fn ty() -> ValueTy

Source§

fn as_value<'a>(&'a self) -> Value<'a, 'static>
where 'static: 'a,

Source§

impl StructuralPartialEq for DynamicMessage

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'ty, T> TypedObj for T
where T: Typed<'ty> + ?Sized,