pub trait EncodingMode {
const MODE: Mode;
// Required methods
fn validate(data: &[u8]) -> bool;
fn invalid_character(data: &[u8]) -> Option<(usize, u8)>;
fn bits_per_character() -> f64;
// Provided method
fn character_count(data: &[u8]) -> usize { ... }
}Expand description
A type-level QR encoding mode.
Required Associated Constants§
Required Methods§
Sourcefn invalid_character(data: &[u8]) -> Option<(usize, u8)>
fn invalid_character(data: &[u8]) -> Option<(usize, u8)>
Returns the first invalid byte for this mode, if any.
Sourcefn bits_per_character() -> f64
fn bits_per_character() -> f64
Approximate payload bits per logical character for this mode.
Provided Methods§
Sourcefn character_count(data: &[u8]) -> usize
fn character_count(data: &[u8]) -> usize
Returns the number of logical characters represented by data.
This differs from data.len() for Kanji mode, where every character is
represented by two Shift-JIS bytes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".