Skip to main content

MutableMessage

Struct MutableMessage 

Source
pub struct MutableMessage<'a, const N: usize, const WORDS: usize> { /* private fields */ }
Expand description

Lazy mutable state for a generated message.

N is the number of schema fields and WORDS is the generated bitset storage. Untouched fields continue to borrow their original encoded words.

Implementations§

Source§

impl<'a, const N: usize, const WORDS: usize> MutableMessage<'a, N, WORDS>

Source

pub fn new() -> Self

Creates empty mutable state with no borrowed source message.

Source

pub fn from_words(words: &'a [u32]) -> Option<Self>

Creates lazy mutable state backed by a validated encoded message.

Source

pub fn has_field(&self, id: usize) -> bool

Returns whether a field exists in the source message or has been set.

Source

pub fn was_accessed(&self, id: usize) -> bool

Returns whether a generated accessor has materialized this field.

Source

pub fn has_any_accessed(&self) -> bool

Source

pub fn clean_words(&self) -> Option<&[u32]>

Returns the untouched source words, or None after any field access.

Source

pub fn get_field<'b, T: MutableField<'a>>( &mut self, id: usize, slot: &'b mut T, ) -> &'b mut T

Lazily decodes a field into its generated storage slot.

Source

pub fn serialize_field<T: MutableField<'a>>( &self, id: usize, field: &T, buffer: &mut Buffer, unit: &mut Unit, ) -> Result<(), MutableError>

Serializes one generated field, reusing untouched source words when safe.

Trait Implementations§

Source§

impl<'a, const N: usize, const WORDS: usize> Clone for MutableMessage<'a, N, WORDS>

Source§

fn clone(&self) -> MutableMessage<'a, N, WORDS>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a, const N: usize, const WORDS: usize> Debug for MutableMessage<'a, N, WORDS>

Source§

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

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

impl<'a, const N: usize, const WORDS: usize> Default for MutableMessage<'a, N, WORDS>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a, const N: usize, const WORDS: usize> Freeze for MutableMessage<'a, N, WORDS>

§

impl<'a, const N: usize, const WORDS: usize> RefUnwindSafe for MutableMessage<'a, N, WORDS>

§

impl<'a, const N: usize, const WORDS: usize> Send for MutableMessage<'a, N, WORDS>

§

impl<'a, const N: usize, const WORDS: usize> Sync for MutableMessage<'a, N, WORDS>

§

impl<'a, const N: usize, const WORDS: usize> Unpin for MutableMessage<'a, N, WORDS>

§

impl<'a, const N: usize, const WORDS: usize> UnsafeUnpin for MutableMessage<'a, N, WORDS>

§

impl<'a, const N: usize, const WORDS: usize> UnwindSafe for MutableMessage<'a, N, WORDS>

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.