pub struct Message<PayloadDefinition> { /* private fields */ }Expand description
A SOME/IP message consisting of a Header and a payload.
Implementations§
Source§impl<PayloadDefinition: PayloadWireFormat> Message<PayloadDefinition>
impl<PayloadDefinition: PayloadWireFormat> Message<PayloadDefinition>
Sourcepub const fn new(header: Header, payload: PayloadDefinition) -> Self
pub const fn new(header: Header, payload: PayloadDefinition) -> Self
Creates a new message from a header and payload.
Sourcepub fn new_sd(
request_id: u32,
sd_header: &<PayloadDefinition as PayloadWireFormat>::SdHeader,
) -> Result<Self, Error>
pub fn new_sd( request_id: u32, sd_header: &<PayloadDefinition as PayloadWireFormat>::SdHeader, ) -> Result<Self, Error>
Creates a new SOME/IP-SD message from a request ID and SD header.
§Errors
Returns the error from Encode::encoded_size on the SD header. No
in-tree SdHeader can fail this – sd::Header::encoded_size is
unconditionally Ok – but PayloadWireFormat is public, and a
downstream implementation may.
Sourcepub const fn set_request_id(&mut self, request_id: u32)
pub const fn set_request_id(&mut self, request_id: u32)
Sets the request ID in the header.
Sourcepub fn sd_header(
&self,
) -> Option<&<PayloadDefinition as PayloadWireFormat>::SdHeader>
pub fn sd_header( &self, ) -> Option<&<PayloadDefinition as PayloadWireFormat>::SdHeader>
Returns the SD header if this is an SD message, or None otherwise.
Sourcepub const fn payload(&self) -> &PayloadDefinition
pub const fn payload(&self) -> &PayloadDefinition
Returns a reference to the payload.
Sourcepub const fn payload_mut(&mut self) -> &mut PayloadDefinition
pub const fn payload_mut(&mut self) -> &mut PayloadDefinition
Returns a mutable reference to the payload.
Trait Implementations§
Source§impl<PayloadDefinition: PayloadWireFormat> Encode for Message<PayloadDefinition>
impl<PayloadDefinition: PayloadWireFormat> Encode for Message<PayloadDefinition>
Source§type Error = Error
type Error = Error
Per-implementation error; constructible from an I/O
embedded_io::ErrorKind
so the fixed-width write_* leaf helpers lift through ?. Read moreSource§fn encode(&self, writer: &mut impl Write) -> Result<usize, Error>
fn encode(&self, writer: &mut impl Write) -> Result<usize, Error>
Serialize into
writer; return the number of bytes written. Read moreSource§fn encode_to_slice(
&self,
buf: &mut [u8],
) -> Result<usize, EncodeToSliceError<Self::Error>>
fn encode_to_slice( &self, buf: &mut [u8], ) -> Result<usize, EncodeToSliceError<Self::Error>>
Encode into a fixed slice, reporting
needed/available
(InsufficientBuffer) instead of a bare
embedded_io::ErrorKind::WriteZero when the slice is too small, and
hiding the &mut &mut [u8] cursor re-borrow every fixed-buffer call
site otherwise writes by hand. Read moreimpl<PayloadDefinition: Eq> Eq for Message<PayloadDefinition>
impl<PayloadDefinition: PartialEq> StructuralPartialEq for Message<PayloadDefinition>
Auto Trait Implementations§
impl<PayloadDefinition> Freeze for Message<PayloadDefinition>where
PayloadDefinition: Freeze,
impl<PayloadDefinition> RefUnwindSafe for Message<PayloadDefinition>where
PayloadDefinition: RefUnwindSafe,
impl<PayloadDefinition> Send for Message<PayloadDefinition>where
PayloadDefinition: Send,
impl<PayloadDefinition> Sync for Message<PayloadDefinition>where
PayloadDefinition: Sync,
impl<PayloadDefinition> Unpin for Message<PayloadDefinition>where
PayloadDefinition: Unpin,
impl<PayloadDefinition> UnsafeUnpin for Message<PayloadDefinition>where
PayloadDefinition: UnsafeUnpin,
impl<PayloadDefinition> UnwindSafe for Message<PayloadDefinition>where
PayloadDefinition: UnwindSafe,
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