Skip to main content

Validator

Trait Validator 

Source
pub trait Validator {
    // Required methods
    fn calculate_crc8(raw: &[u8]) -> u8;
    fn calculate_crc16(raw: &[u8]) -> u16;
}
Expand description

CRC validator abstraction for the frame protocol.

Implementations define how frame integrity is verified:

  • CRC8 for the frame header
  • CRC16 for the frame body

Required Methods§

Source

fn calculate_crc8(raw: &[u8]) -> u8

Calculate CRC8 over the given raw bytes.

Typically used for validating the frame header.

Source

fn calculate_crc16(raw: &[u8]) -> u16

Calculate CRC16 over the given raw bytes.

Typically used for validating the full frame (header + command + payload).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§