Trait swh_graph::mph::SwhidMphf

source ·
pub trait SwhidMphf {
    // Required methods
    fn load(basepath: impl AsRef<Path>) -> Result<Self>
       where Self: Sized;
    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 implementor structs in an enum to dynamically choose which MPH algorithm to use with less overhead than dyn SwhidMphf.

Required Methods§

source

fn load(basepath: impl AsRef<Path>) -> Result<Self>where Self: Sized,

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

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl SwhidMphf for Function

source§

fn load(basepath: impl AsRef<Path>) -> Result<Self>where Self: Sized,

source§

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

source§

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

Implementors§