pub struct PHTable {
pub table: Vec<PHTableEntry>,
}
Fields§
§table: Vec<PHTableEntry>
Implementations§
source§impl PHTable
impl PHTable
sourcepub fn new(size: usize) -> Self
pub fn new(size: usize) -> Self
Constructs a new instance of PHTable by allocating size
bytes of memory.
sourcepub fn add(&self, hash: u64, score_opening: i16, score_ending: i16)
pub fn add(&self, hash: u64, score_opening: i16, score_ending: i16)
Adds a new entry (storing the key, score_opening
and score_ending
) using hash
to calculate an index.
sourcepub fn get(&self, hash: u64) -> Option<PHTableResult>
pub fn get(&self, hash: u64) -> Option<PHTableResult>
Gets a wanted entry using hash
to calculate an index. Returns None if entry does not exists
or hash
is incompatible with the stored key.
sourcepub fn get_usage(&self, resolution: usize) -> f32
pub fn get_usage(&self, resolution: usize) -> f32
Calculates an approximate percentage usage of the table, based on the first resolution
entries.
Auto Trait Implementations§
impl RefUnwindSafe for PHTable
impl Send for PHTable
impl Sync for PHTable
impl Unpin for PHTable
impl UnwindSafe for PHTable
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