pub struct SerializedMessage { /* private fields */ }Expand description
A message (struct) to be signed, serialized to a byte array, along with the content format of the bytes.
Implementations§
Source§impl SerializedMessage
impl SerializedMessage
Sourcepub fn from_bytes(bytes: Vec<u8>, content_type: CoapContentFormat) -> Self
pub fn from_bytes(bytes: Vec<u8>, content_type: CoapContentFormat) -> Self
Creates a new SerializedMessage from a byte array and content type.
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Returns the serialized message bytes as a slice. This representation needs to be used together with a content type to deserialize the message correctly.
Sourcepub fn decode<Message: DeserializeOwned>(
&self,
) -> Result<Message, EncodingError>
pub fn decode<Message: DeserializeOwned>( &self, ) -> Result<Message, EncodingError>
Creates a new SerializedMessage from a byte array and content type.
This currently implements only CBOR serialization, so the content type must be Cbor.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SerializedMessage
impl RefUnwindSafe for SerializedMessage
impl Send for SerializedMessage
impl Sync for SerializedMessage
impl Unpin for SerializedMessage
impl UnwindSafe for SerializedMessage
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more