pub struct Crc16 { /* private fields */ }Expand description
An incremental CRC-16/CCITT-FALSE accumulator.
CCITT-FALSE is the long-standing checksum of short radio frames: polynomial 0x1021,
initial value 0xFFFF, no reflection, and no final inversion. The accumulator lets a
checksum span more than one slice, which the mesh frame needs because it sums its
header and its payload while skipping the mutable hop-limit byte between them. For a
single contiguous slice, crc16 is the one-shot form.
§Examples
use pamoja_mesh::Crc16;
// Summing in two parts matches summing the whole in one go.
let mut crc = Crc16::new();
crc.update(b"1234");
crc.update(b"56789");
assert_eq!(crc.finish(), 0x29B1);Implementations§
Trait Implementations§
impl Copy for Crc16
impl Eq for Crc16
impl StructuralPartialEq for Crc16
Auto Trait Implementations§
impl Freeze for Crc16
impl RefUnwindSafe for Crc16
impl Send for Crc16
impl Sync for Crc16
impl Unpin for Crc16
impl UnsafeUnpin for Crc16
impl UnwindSafe for Crc16
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