Struct EncodedMessageView

Source
pub struct EncodedMessageView<EM: EncodedMessage> { /* private fields */ }
Expand description

A wrapper around any data structure containing a readable message

This is not Sync – while it is currently a zero-sized wrapper, it may gain optimizations later such as memoizing where the payload begins (and this is only practical with interior mutability).

See Message for how this does not perform early validation and handles message errors.

Implementations§

Source§

impl<EM: EncodedMessage> EncodedMessageView<EM>

Source

pub fn new(inner: EM) -> Self

Trait Implementations§

Source§

impl<EM: EncodedMessage> AsRef<EM> for EncodedMessageView<EM>

When the inner item stores more than just the code and encoded options, this can be used to gain read-only access to any additional data. (Mutating access is blocked to ensure that future optimizations like memoizing the payload position are possible; it might still be enabled if memoized data is cleared just to be on the safe side).

Source§

fn as_ref(&self) -> &EM

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<EM: Clone + EncodedMessage> Clone for EncodedMessageView<EM>

Source§

fn clone(&self) -> EncodedMessageView<EM>

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<EM: Debug + EncodedMessage> Debug for EncodedMessageView<EM>

Source§

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

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

impl<EM> Format for EncodedMessageView<EM>

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl<EM: EncodedMessage> ReadableMessage for EncodedMessageView<EM>

Source§

type Code = u8

Source§

type MessageOption<'a> = MessageOption<'a> where Self: 'a

Type of an individual option, indiciating its option number and value
Source§

type OptionsIter<'a> = OptionsIter<'a> where Self: 'a

Source§

fn code(&self) -> u8

Get the code (request method or response code) of the message Read more
Source§

fn payload(&self) -> &[u8]

Get the payload set in the message Read more
Source§

fn options(&self) -> OptionsIter<'_>

Produce all options in arbitrary order as an iterator Read more
Source§

fn with_static_type_annotation(&self) -> Option<RefWithStaticType<'_, Self>>

Type ID of Self or a ’static version of Self Read more

Auto Trait Implementations§

§

impl<EM> Freeze for EncodedMessageView<EM>
where EM: Freeze,

§

impl<EM> !RefUnwindSafe for EncodedMessageView<EM>

§

impl<EM> Send for EncodedMessageView<EM>
where EM: Send,

§

impl<EM> !Sync for EncodedMessageView<EM>

§

impl<EM> Unpin for EncodedMessageView<EM>
where EM: Unpin,

§

impl<EM> UnwindSafe for EncodedMessageView<EM>
where EM: UnwindSafe,

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<M> ShowMessageExt for M
where M: ReadableMessage,

Source§

fn show(&self) -> ShowMessage<'_, Self>

Wraps the message to have a core::fmt::Debug imlementation, and also provide [defmt_0_3::Format] if the defmt_0_3 feature is selected. Read more
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.