Struct someip_parse::TpHeader[][src]

pub struct TpHeader {
    pub more_segment: bool,
    // some fields omitted
}
Expand description

Additional header when a packet contains a TP header (transporting large SOME/IP messages).

Fields

more_segment: bool

Flag signaling that more packets should follow

Implementations

Creates a tp header with offset 0 and the given “move_segment” flag.

Example:
use someip_parse::TpHeader;

// create a header with the more_segement flag set
let header = TpHeader::new(true);

assert_eq!(0, header.offset());
assert_eq!(true, header.more_segment);

Creates a tp header with the given offset & “more_segment” flag if the offset is a multiple of 16. Otherwise an TpOffsetNotMultipleOf16 error is returned.

Example:
use someip_parse::{TpHeader, ValueError};
 
// create a header with offset 32 (multiple of 16) and the more_segement flag set
let header = TpHeader::with_offset(32, true).unwrap();

assert_eq!(32, header.offset());
assert_eq!(true, header.more_segment);

// try to create a header with a bad offset (non multiple of 16)
let error = TpHeader::with_offset(31, false);

assert_eq!(Err(ValueError::TpOffsetNotMultipleOf16(31)), error);

Returns the offset field of the tp header. The offset defines

Sets the field of the header and returns Ok(()) on success. Note: The value must be a multiple of 16.

If the given value is not a multiple of 16, the value is not set and an error ValueError::TpOffsetNotMultipleOf16 is returned.

Read a header from a byte stream.

Reads a tp header from a slice.

Writes the header to the given writer.

Writes the header to a slice.

Writes the header to a slice without checking the slice length.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.