pub struct Repr<'a> {
pub message_id: MessageId,
pub length: u32,
pub request_id: RequestId,
pub protocol_version: u8,
pub interface_version: u8,
pub message_type: MessageType,
pub return_code: ReturnCode,
pub data: &'a [u8],
}Expand description
A high-level representation of a Some/IP message.
§Creating a Repr
The preferred way to create a Repr is using Repr::new(), which automatically
calculates the correct length field. However, you can also construct it manually
using struct initialization if needed.
Fields§
§message_id: MessageIdMessage ID (32 bits)
length: u32Length field (32 bits) - automatically calculated as 8 + data.len() when using new()
request_id: RequestIdRequest ID (32 bits)
protocol_version: u8Protocol version (8 bits)
interface_version: u8Interface version (8 bits)
message_type: MessageTypeMessage type (8 bits)
return_code: ReturnCodeReturn code (8 bits)
data: &'a [u8]Payload data (variable length)
Implementations§
Source§impl<'a> Repr<'a>
impl<'a> Repr<'a>
Sourcepub fn new(
message_id: MessageId,
request_id: RequestId,
protocol_version: u8,
interface_version: u8,
message_type: MessageType,
return_code: ReturnCode,
data: &'a [u8],
) -> Self
pub fn new( message_id: MessageId, request_id: RequestId, protocol_version: u8, interface_version: u8, message_type: MessageType, return_code: ReturnCode, data: &'a [u8], ) -> Self
Create a new SOME/IP message representation. The length field is automatically calculated as 8 (header bytes) + data.len().
§Arguments
message_id- The message IDrequest_id- The request IDprotocol_version- Protocol version (typically 0x01)interface_version- Interface versionmessage_type- The message typereturn_code- The return codedata- The payload data
§Returns
A new Repr instance with the length field automatically calculated.
pub fn parse<T>(packet: &'a Packet<T>) -> Result<Repr<'a>, Error>
Trait Implementations§
impl<'a> Copy for Repr<'a>
impl<'a> Eq for Repr<'a>
impl<'a> StructuralPartialEq for Repr<'a>
Auto Trait Implementations§
impl<'a> Freeze for Repr<'a>
impl<'a> RefUnwindSafe for Repr<'a>
impl<'a> Send for Repr<'a>
impl<'a> Sync for Repr<'a>
impl<'a> Unpin for Repr<'a>
impl<'a> UnwindSafe for Repr<'a>
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