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);
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.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TpHeader
impl UnwindSafe for TpHeader
Blanket Implementations
Mutably borrows from an owned value. Read more