pub struct Signals { /* private fields */ }Expand description
The eight data bytes of a J1939 frame.
§Examples
use pamoja_can::Signals;
// Engine speed sits in bytes 4 and 5 of EEC1, at 0.125 rpm per bit.
let mut payload = Signals::new();
payload.set_u16(3, (1000.0 / 0.125) as u16);
assert_eq!(payload.u16(3), Some(8000));
assert_eq!(payload.u8(0), Some(pamoja_can::NOT_AVAILABLE));Implementations§
Source§impl Signals
impl Signals
Sourcepub fn new() -> Signals
pub fn new() -> Signals
Builds a payload with every signal marked not available.
§Returns
Eight bytes of NOT_AVAILABLE, ready for a sender to write only what it has.
Sourcepub fn from_bytes(bytes: [u8; 8]) -> Signals
pub fn from_bytes(bytes: [u8; 8]) -> Signals
Trait Implementations§
impl Copy for Signals
impl Eq for Signals
impl StructuralPartialEq for Signals
Auto Trait Implementations§
impl Freeze for Signals
impl RefUnwindSafe for Signals
impl Send for Signals
impl Sync for Signals
impl Unpin for Signals
impl UnsafeUnpin for Signals
impl UnwindSafe for Signals
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