pub trait DecodingStrategy:
Send
+ Sync
+ 'static {
type Code: Clone + Debug + Send + Sync;
// Required methods
fn from_intensities(intensities: &[f64], thresholds: &[f64]) -> Self::Code;
fn distance(code: &Self::Code, target: u64) -> u32;
fn decode(
code: &Self::Code,
decoder: &(impl TagDecoder + ?Sized),
max_error: u32,
) -> Option<(u32, u32, u8)>;
fn to_debug_bits(code: &Self::Code) -> u64;
}Expand description
Trait abstracting the decoding strategy (Hard vs Soft).
Required Associated Types§
Required Methods§
Sourcefn from_intensities(intensities: &[f64], thresholds: &[f64]) -> Self::Code
fn from_intensities(intensities: &[f64], thresholds: &[f64]) -> Self::Code
Convert intensities and thresholds into a code.
Sourcefn distance(code: &Self::Code, target: u64) -> u32
fn distance(code: &Self::Code, target: u64) -> u32
Compute the “distance” between the extracted code and a dictionary target.
For Hard decoding, this is Hamming distance. For Soft decoding, this is the accumulated penalty of mismatching LLRs.
Sourcefn decode(
code: &Self::Code,
decoder: &(impl TagDecoder + ?Sized),
max_error: u32,
) -> Option<(u32, u32, u8)>
fn decode( code: &Self::Code, decoder: &(impl TagDecoder + ?Sized), max_error: u32, ) -> Option<(u32, u32, u8)>
Decode the code into an ID using the provided decoder.
Sourcefn to_debug_bits(code: &Self::Code) -> u64
fn to_debug_bits(code: &Self::Code) -> u64
Convert the code to a debug bitstream (u64).
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.