pub struct EsbHeader { /* private fields */ }Expand description
The non-payload portion of an ESB packet
This is typically used to create a Packet Grant using methods
from the EsbApp or EsbIrq
interfaces.
§Example
use esb::EsbHeader;
let builder_result = EsbHeader::build()
.max_payload(252)
.pid(0)
.pipe(1)
.no_ack(true)
.check();
let new_result = EsbHeader::new(
252,
0,
1,
true,
);
assert_eq!(builder_result, new_result);Implementations§
Source§impl EsbHeader
impl EsbHeader
Sourcepub fn build() -> EsbHeaderBuilder
pub fn build() -> EsbHeaderBuilder
Create a new packet header using a builder pattern
See the docs for EsbBuilder for more
information.
Sourcepub fn new(
max_payload_length: u8,
pid: u8,
pipe: u8,
no_ack: bool,
) -> Result<Self, Error>
pub fn new( max_payload_length: u8, pid: u8, pipe: u8, no_ack: bool, ) -> Result<Self, Error>
Create a new packet header
Notes on valid values:
max_payload_lengthmust be between 0 and 252 bytes, inclusive.pidmust be between 0 and 3, inclusive.pipemust be between 0 and 7, inclusive.
Sourcepub fn payload_len(self) -> u16
pub fn payload_len(self) -> u16
Accessor for the length (in bytes) of the payload
Trait Implementations§
impl Copy for EsbHeader
impl Eq for EsbHeader
impl StructuralPartialEq for EsbHeader
Auto Trait Implementations§
impl Freeze for EsbHeader
impl RefUnwindSafe for EsbHeader
impl Send for EsbHeader
impl Sync for EsbHeader
impl Unpin for EsbHeader
impl UnwindSafe for EsbHeader
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