SwhidMphf

Trait SwhidMphf 

Source
pub trait SwhidMphf {
    // Required methods
    fn hash_str(&self, swhid: impl AsRef<str>) -> Option<NodeId>;
    fn hash_str_array(&self, swhid: &[u8; 50]) -> Option<NodeId>;

    // Provided methods
    fn hash_array(&self, swhid: &[u8; 22]) -> Option<NodeId> { ... }
    fn hash_swhid(&self, swhid: &SWHID) -> Option<NodeId> { ... }
}
Expand description

Minimal-perfect hash function over SWHID.

See DynMphf which wraps all implementer structs in an enum to dynamically choose which MPH algorithm to use with less overhead than dyn SwhidMphf.

Required Methods§

Source

fn hash_str(&self, swhid: impl AsRef<str>) -> Option<NodeId>

Hashes a SWHID’s textual representation

Source

fn hash_str_array(&self, swhid: &[u8; 50]) -> Option<NodeId>

Hashes a SWHID’s textual representation

Provided Methods§

Source

fn hash_array(&self, swhid: &[u8; 22]) -> Option<NodeId>

Hashes a SWHID’s binary representation

Source

fn hash_swhid(&self, swhid: &SWHID) -> Option<NodeId>

Hashes a SWHID

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.

Implementors§