pub struct SignatureDatabase { /* private fields */ }Expand description
An in-memory database of ContentSignature values.
Implementations§
Source§impl SignatureDatabase
impl SignatureDatabase
Sourcepub fn store(&mut self, sig: ContentSignature)
pub fn store(&mut self, sig: ContentSignature)
Store a signature, appending it to the list for its asset_id.
Sourcepub fn lookup(&self, asset_id: &str) -> &[ContentSignature]
pub fn lookup(&self, asset_id: &str) -> &[ContentSignature]
Look up all signatures associated with asset_id.
Sourcepub fn match_count(&self) -> usize
pub fn match_count(&self) -> usize
Return the total number of signatures stored across all assets.
Sourcepub fn find_matches(
&self,
query: &ContentSignature,
tolerance: u32,
) -> Vec<(String, usize)>
pub fn find_matches( &self, query: &ContentSignature, tolerance: u32, ) -> Vec<(String, usize)>
Find all assets whose signatures match query within tolerance.
Returns a list of (asset_id, matching_signature_count) pairs.
Sourcepub fn remove_asset(&mut self, asset_id: &str) -> Vec<ContentSignature>
pub fn remove_asset(&mut self, asset_id: &str) -> Vec<ContentSignature>
Remove all signatures for asset_id, returning the removed list.
Sourcepub fn asset_count(&self) -> usize
pub fn asset_count(&self) -> usize
Return the number of distinct assets tracked.
Trait Implementations§
Source§impl Debug for SignatureDatabase
impl Debug for SignatureDatabase
Source§impl Default for SignatureDatabase
impl Default for SignatureDatabase
Source§fn default() -> SignatureDatabase
fn default() -> SignatureDatabase
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SignatureDatabase
impl RefUnwindSafe for SignatureDatabase
impl Send for SignatureDatabase
impl Sync for SignatureDatabase
impl Unpin for SignatureDatabase
impl UnsafeUnpin for SignatureDatabase
impl UnwindSafe for SignatureDatabase
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> 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