Skip to main content

CandidateBytes

Trait CandidateBytes 

Source
pub trait CandidateBytes {
    // Required method
    fn candidate_bytes(
        &mut self,
        candidate: &Candidate,
    ) -> Result<Rc<[u8]>, CandidateError>;
}
Expand description

What: Where a scan pass reads candidate bytes. A trait is an interface. Why: The candidate store reads the version’s objects; a direct fix reads the same objects with its in-memory corrections laid over them, and its later passes must scan the corrected bytes.

In TS you’d write (pseudocode):

interface CandidateBytes { bytes(candidate: Candidate): Promise<Uint8Array> }

Required Methods§

Source

fn candidate_bytes( &mut self, candidate: &Candidate, ) -> Result<Rc<[u8]>, CandidateError>

What: The bytes the candidate holds for this reader. Why: the scan’s only input.

In TS you’d write (pseudocode):

bytes(candidate: Candidate): Promise<Uint8Array>; // throws CandidateError

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl CandidateBytes for CandidateStore

What: impl CandidateBytes for CandidateStore reads through the store itself. Why: Without corrections the store’s objects are the bytes to scan.

In TS you’d write (pseudocode):

class CandidateStore implements CandidateBytes {}