pub struct PrefixHasher { /* private fields */ }Expand description
The running v2 key of one solver process (ADR 0008).
Feed it every byte sent to the process, exactly as sent, in order. At a
check, after feeding the check command’s bytes, PrefixHasher::key
gives the key. Nothing is normalized: whitespace and comments between
commands count too.
Implementations§
Source§impl PrefixHasher
impl PrefixHasher
Sourcepub fn new(solver: &SolverIdentity, mode: &Mode) -> Self
pub fn new(solver: &SolverIdentity, mode: &Mode) -> Self
A hasher for a new process of solver under mode.
Sourcepub fn update(&mut self, bytes: &[u8])
pub fn update(&mut self, bytes: &[u8])
Feeds the next bytes the process received without changing their order. Counter overflow permanently removes exact-length authority.
Sourcepub fn feed(&mut self, feed: &PrefixFeed<'_>) -> bool
pub fn feed(&mut self, feed: &PrefixFeed<'_>) -> bool
Feeds a checked raw interval only at its exact next byte position. Failure permanently removes exact-length authority without changing input forwarding.
Sourcepub fn len(&self) -> u64
pub fn len(&self) -> u64
Bytes fed so far. Use Self::is_exact before relying on the counter.
Sourcepub fn is_exact(&self) -> bool
pub fn is_exact(&self) -> bool
Whether the cumulative length still represents every supplied byte.
Sourcepub fn key(&self) -> QueryKey
pub fn key(&self) -> QueryKey
The unchanged v2 key, including the end marker and cumulative length.
Cache users must also require Self::is_exact.
Sourcepub fn silence_key(&self) -> QueryKey
pub fn silence_key(&self) -> QueryKey
Key for complete clean session silence, distinct from normal reply keys.
Feed all trailing bytes first and require Self::is_exact.