pub struct CorpusIndexImpl { /* private fields */ }Expand description
In-memory corpus index backed by a HashMap<file_hash, CorpusEntry>.
Search uses a linear scan with Hamming distance — sufficient for corpora
up to ~100 K images. Interior mutability via RefCell keeps the port
trait’s &self receiver while allowing mutation during add_to_index
and build_index.
Implementations§
Source§impl CorpusIndexImpl
impl CorpusIndexImpl
Sourcepub fn add_entry_with_key(&self, entry: CorpusEntry)
pub fn add_entry_with_key(&self, entry: CorpusEntry)
Insert a pre-built CorpusEntry that already carries a
SpectralKey. Used by higher-level pipelines that have already
decoded the image and run spectral analysis.
Trait Implementations§
Source§impl CorpusIndex for CorpusIndexImpl
impl CorpusIndex for CorpusIndexImpl
Source§fn search(
&self,
payload: &Payload,
_technique: StegoTechnique,
max_results: usize,
) -> Result<Vec<CorpusEntry>, CorpusError>
fn search( &self, payload: &Payload, _technique: StegoTechnique, max_results: usize, ) -> Result<Vec<CorpusEntry>, CorpusError>
Search the index for covers whose natural bit pattern already encodes
(or closely encodes)
payload using technique. Read moreSource§fn add_to_index(&self, path: &Path) -> Result<CorpusEntry, CorpusError>
fn add_to_index(&self, path: &Path) -> Result<CorpusEntry, CorpusError>
Add the file at
path to the index, computing its bit-pattern
fingerprint. Read moreSource§fn build_index(&self, corpus_dir: &Path) -> Result<usize, CorpusError>
fn build_index(&self, corpus_dir: &Path) -> Result<usize, CorpusError>
Scan
corpus_dir recursively and build the full index. Read moreSource§fn search_for_model(
&self,
payload: &Payload,
model_id: &str,
resolution: (u32, u32),
max_results: usize,
) -> Result<Vec<CorpusEntry>, CorpusError>
fn search_for_model( &self, payload: &Payload, model_id: &str, resolution: (u32, u32), max_results: usize, ) -> Result<Vec<CorpusEntry>, CorpusError>
Search the index for covers that match
payload and have a
spectral_key whose model_id and resolution match the supplied
values. Read moreSource§fn model_stats(&self) -> Vec<(SpectralKey, usize)>
fn model_stats(&self) -> Vec<(SpectralKey, usize)>
Return a sorted list of
(SpectralKey, count) pairs describing how
many corpus entries are indexed per model/resolution combination. Read moreAuto Trait Implementations§
impl !Freeze for CorpusIndexImpl
impl !RefUnwindSafe for CorpusIndexImpl
impl Send for CorpusIndexImpl
impl !Sync for CorpusIndexImpl
impl Unpin for CorpusIndexImpl
impl UnsafeUnpin for CorpusIndexImpl
impl UnwindSafe for CorpusIndexImpl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more