pub struct Header { /* private fields */ }
Expand description
SOME/IP header.
Implementations§
Source§impl Header
impl Header
Sourcepub fn new(
message_id: MessageId,
length: Length,
request_id: RequestId,
protocol_version: ProtocolVersion,
interface_version: InterfaceVersion,
message_type: MessageType,
return_code: ReturnCode,
) -> Header
pub fn new( message_id: MessageId, length: Length, request_id: RequestId, protocol_version: ProtocolVersion, interface_version: InterfaceVersion, message_type: MessageType, return_code: ReturnCode, ) -> Header
Creates a new Header
.
Sourcepub fn message_id(&self) -> MessageId
pub fn message_id(&self) -> MessageId
Returns the MessageId
.
Sourcepub fn request_id(&self) -> RequestId
pub fn request_id(&self) -> RequestId
Returns the RequestId
.
Sourcepub fn protocol_version(&self) -> ProtocolVersion
pub fn protocol_version(&self) -> ProtocolVersion
Returns the ProtocolVersion
.
Sourcepub fn interface_version(&self) -> InterfaceVersion
pub fn interface_version(&self) -> InterfaceVersion
Returns the InterfaceVersion
.
Sourcepub fn message_type(&self) -> MessageType
pub fn message_type(&self) -> MessageType
Returns the MessageType
.
Sourcepub fn return_code(&self) -> ReturnCode
pub fn return_code(&self) -> ReturnCode
Returns the ReturnCode
.
Sourcepub fn set_message_id(&mut self, message_id: MessageId)
pub fn set_message_id(&mut self, message_id: MessageId)
Returns the MessageId
.
Sourcepub fn set_length(&mut self, length: Length)
pub fn set_length(&mut self, length: Length)
Sets the Length
.
Sourcepub fn set_request_id(&mut self, request_id: RequestId)
pub fn set_request_id(&mut self, request_id: RequestId)
Sets the RequestId
.
Sourcepub fn set_protocol_version(&mut self, protocol_version: ProtocolVersion)
pub fn set_protocol_version(&mut self, protocol_version: ProtocolVersion)
Sets the ProtocolVersion
.
Sourcepub fn set_interface_version(&mut self, interface_version: InterfaceVersion)
pub fn set_interface_version(&mut self, interface_version: InterfaceVersion)
Sets the InterfaceVersion
.
Sourcepub fn set_message_type(&mut self, message_type: MessageType)
pub fn set_message_type(&mut self, message_type: MessageType)
Sets the MessageType
.
Sourcepub fn set_return_code(&mut self, return_code: ReturnCode)
pub fn set_return_code(&mut self, return_code: ReturnCode)
Sets the ReturnCode
.
Sourcepub fn parse_with_payload(
bytes: &[u8],
) -> Result<(Header, Payload<'_>), ParseError>
pub fn parse_with_payload( bytes: &[u8], ) -> Result<(Header, Payload<'_>), ParseError>
Splits the bytes into header and payload and returns the header as a Header
.
Sourcepub fn serialize_with_payload<'a>(
&mut self,
payload: Payload<'_>,
buffer: &'a mut [u8],
) -> Result<&'a [u8], SerializeError>
pub fn serialize_with_payload<'a>( &mut self, payload: Payload<'_>, buffer: &'a mut [u8], ) -> Result<&'a [u8], SerializeError>
Serializes the header and the payload into one packet.
Trait Implementations§
Source§impl<'a> Parse<'a> for Header
impl<'a> Parse<'a> for Header
Source§fn parse_partial(reader: &mut ByteReader<'a>) -> Result<Header, ParseError>
fn parse_partial(reader: &mut ByteReader<'a>) -> Result<Header, ParseError>
Parses a SOME/IP payload type from a given slice of bytes. Read more
Source§impl Serialize for Header
impl Serialize for Header
Source§fn required_length(&self) -> usize
fn required_length(&self) -> usize
Returns the number of bytes required to store the serialized version of self.
Source§fn serialize_partial(
&self,
writer: &mut ByteWriter<'_>,
) -> Result<(), SerializeError>
fn serialize_partial( &self, writer: &mut ByteWriter<'_>, ) -> Result<(), SerializeError>
Serializes to a byte writer.
impl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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