pub trait EtherCrabWireWrite {
// Required methods
fn pack_to_slice_unchecked<'buf>(&self, buf: &'buf mut [u8]) -> &'buf [u8] ⓘ;
fn packed_len(&self) -> usize;
// Provided method
fn pack_to_slice<'buf>(
&self,
buf: &'buf mut [u8],
) -> Result<&'buf [u8], WireError> { ... }
}
Expand description
A type to be sent/received on the wire, according to EtherCAT spec rules (packed bits, little endian).
This trait is derivable.
Required Methods§
Sourcefn pack_to_slice_unchecked<'buf>(&self, buf: &'buf mut [u8]) -> &'buf [u8] ⓘ
fn pack_to_slice_unchecked<'buf>(&self, buf: &'buf mut [u8]) -> &'buf [u8] ⓘ
Pack the type and write it into the beginning of buf
.
§Panics
This method must panic if buf
is too short to hold the packed data.
Sourcefn packed_len(&self) -> usize
fn packed_len(&self) -> usize
Get the length in bytes of this item when packed.