pub struct GOVMPH {
    pub size: u64,
    pub multiplier: u64,
    pub global_seed: u64,
    pub edge_offset_and_seed: Vec<u64>,
    pub array: Vec<u64>,
}
Expand description

A stub to load and access Genuzio-Ottaviano-Vigna minimal perfect hash functions.

To generate the structure you must use the Java version:

java it.unimi.dsi.sux4j.mph.GOVMinimalPerfectHashFunction --byte-array SOURCE test.mph

To obtain a file that can be read by this structure, load the serialized Java instance of the minimal perfect hash function and dump it in C-compatible format:

echo '((it.unimi.dsi.sux4j.mph.GOVMinimalPerfectHashFunction)it.unimi.dsi.fastutil.io.BinIO.loadObject("test.mph")).dump("test.cmph");' | jshell

You can now load the dumped file with the load method.

Reference:

Fields§

§size: u64§multiplier: u64§global_seed: u64§edge_offset_and_seed: Vec<u64>§array: Vec<u64>

Implementations§

source§

impl GOVMPH

source

pub fn size(&self) -> u64

source

pub fn get_byte_array(&self, key: &[u8]) -> u64

source§

impl GOVMPH

source

pub fn load<P: AsRef<Path>>(path: P) -> Result<Self>

Given a path to a file .cmph generated from the java version, load a GOVMPH structure from a file

source

pub fn load_reader<F: Read>(file: F) -> Result<Self>

Given a generic Read implementor, load a GOVMPH structure from a file.

Trait Implementations§

source§

impl Debug for GOVMPH

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl SwhidMphf for GOVMPH

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
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

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CastableFrom<T> for T

§

fn cast_from(value: T) -> T

Call Self as W
§

impl<T, U> CastableInto<U> for Twhere U: CastableFrom<T>,

§

fn cast(self) -> U

Call W::cast_from(self)
§

impl<T> DowncastableFrom<T> for T

§

fn downcast_from(value: T) -> T

Truncate the current UnsignedInt to a possibly smaller size
§

impl<T, U> DowncastableInto<U> for Twhere U: DowncastableFrom<T>,

§

fn downcast(self) -> U

Call W::downcast_from(self)
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, W> HasTypeWitness<W> for Twhere W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

impl<T> Identity for Twhere T: ?Sized,

§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Splat<T> for T

§

fn splat(value: T) -> T

§

impl<T> To<T> for T

§

fn to(self) -> T

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> UpcastableFrom<T> for T

§

fn upcast_from(value: T) -> T

Extend the current UnsignedInt to a possibly bigger size.
§

impl<T, U> UpcastableInto<U> for Twhere U: UpcastableFrom<T>,

§

fn upcast(self) -> U

Call W::upcast_from(self)
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Allocation for Twhere T: RefUnwindSafe + Send + Sync,