Struct inanis::cache::pawns::PawnHashTable
source · pub struct PawnHashTable {
pub table: Vec<PawnHashTableEntry>,
}
Fields§
§table: Vec<PawnHashTableEntry>
Implementations§
source§impl PawnHashTable
impl PawnHashTable
sourcepub fn new(size: usize) -> Self
pub fn new(size: usize) -> Self
Constructs a new instance of PawnHashTable by allocating size
bytes of memory.
sourcepub fn add(&self, hash: u64, score: i16)
pub fn add(&self, hash: u64, score: i16)
Adds a new entry (storing the key and score
) using hash & (self.table.len() - 1)
formula to calculate an index.
sourcepub fn get(&self, hash: u64) -> Option<PawnHashTableResult>
pub fn get(&self, hash: u64) -> Option<PawnHashTableResult>
Gets a wanted entry using hash & (self.table.len() - 1)
formula to calculate an index. Returns None if 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.
Trait Implementations§
source§impl Clone for PawnHashTable
impl Clone for PawnHashTable
source§fn clone(&self) -> PawnHashTable
fn clone(&self) -> PawnHashTable
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for PawnHashTable
impl Send for PawnHashTable
impl Sync for PawnHashTable
impl Unpin for PawnHashTable
impl UnwindSafe for PawnHashTable
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