Skip to main content

HeaderView

Struct HeaderView 

Source
pub struct HeaderView<'a>(/* private fields */);
Expand description

Zero-copy view into a 16-byte SOME/IP header in a buffer.

Implementations§

Source§

impl<'a> HeaderView<'a>

Source

pub fn parse(buf: &'a [u8]) -> Result<(Self, &'a [u8]), Error>

Parse and validate a SOME/IP header from the beginning of buf. Returns (view, remaining_bytes) on success.

§Errors

Returns an error if buf is shorter than 16 bytes, the protocol version is not 0x01, the message type byte is unrecognized, or the return code is invalid.

§Panics

Cannot panic — the expect is guarded by a length check above it.

Source

pub fn message_id(&self) -> MessageId

Returns the message ID (service ID + method ID).

Source

pub fn length(&self) -> u32

Returns the length field (payload size + 8).

Source

pub fn request_id(&self) -> u32

Returns the request ID (client ID + session ID).

Source

pub fn payload_size(&self) -> usize

Returns the payload size in bytes (length - 8).

Source

pub fn protocol_version(&self) -> u8

Returns the protocol version.

Source

pub fn interface_version(&self) -> u8

Returns the interface version.

Source

pub fn message_type(&self) -> MessageTypeField

Returns the message type field.

§Panics

Cannot panic — the value is validated during Self::parse.

Source

pub fn return_code(&self) -> ReturnCode

Returns the return code.

§Panics

Cannot panic — the value is validated during Self::parse.

Source

pub fn is_sd(&self) -> bool

Returns true if this is a SOME/IP-SD message.

Source

pub fn to_owned(&self) -> Header

Copies the view into an owned Header.

Trait Implementations§

Source§

impl<'a> Clone for HeaderView<'a>

Source§

fn clone(&self) -> HeaderView<'a>

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<'a> Debug for HeaderView<'a>

Source§

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

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

impl<'a> Copy for HeaderView<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for HeaderView<'a>

§

impl<'a> RefUnwindSafe for HeaderView<'a>

§

impl<'a> Send for HeaderView<'a>

§

impl<'a> Sync for HeaderView<'a>

§

impl<'a> Unpin for HeaderView<'a>

§

impl<'a> UnsafeUnpin for HeaderView<'a>

§

impl<'a> UnwindSafe for HeaderView<'a>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more