Trait HashStorer

Source
pub trait HashStorer {
    // Required methods
    fn clear(&mut self);
    fn get(&self) -> Option<u64>;
    fn get_or_init<F>(&self, f: F) -> u64
       where F: FnOnce() -> u64;

    // Provided method
    fn hash_one<T, H>(value: &T) -> u64
       where T: ?Sized + Hash,
             H: Hasher + Default,
             Self: Default { ... }
}
Expand description

storage trait for storing hash status

Required Methods§

Source

fn clear(&mut self)

Clear stored hash code to none

Source

fn get(&self) -> Option<u64>

Get stored hash code

Source

fn get_or_init<F>(&self, f: F) -> u64
where F: FnOnce() -> u64,

if stored hash code is uninit, call init func

return inited hash code

Provided Methods§

Source

fn hash_one<T, H>(value: &T) -> u64
where T: ?Sized + Hash, H: Hasher + Default, Self: Default,

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.

Implementations on Foreign Types§

Source§

impl HashStorer for Cell<u64>

Source§

fn clear(&mut self)

Source§

fn get(&self) -> Option<u64>

Source§

fn get_or_init<F>(&self, f: F) -> u64
where F: FnOnce() -> u64,

Source§

impl HashStorer for AtomicU64

Source§

fn clear(&mut self)

Source§

fn get(&self) -> Option<u64>

Source§

fn get_or_init<F>(&self, f: F) -> u64
where F: FnOnce() -> u64,

Source§

impl<T: HashStorer + Default> HashStorer for Rc<T>

Source§

fn get(&self) -> Option<u64>

Source§

fn clear(&mut self)

Source§

fn get_or_init<F>(&self, f: F) -> u64
where F: FnOnce() -> u64,

Source§

fn hash_one<T1, H>(value: &T1) -> u64
where T1: ?Sized + Hash, H: Hasher + Default, Self: Default,

Source§

impl<T: HashStorer + Default> HashStorer for Arc<T>

Source§

fn get(&self) -> Option<u64>

Source§

fn clear(&mut self)

Source§

fn get_or_init<F>(&self, f: F) -> u64
where F: FnOnce() -> u64,

Source§

fn hash_one<T1, H>(value: &T1) -> u64
where T1: ?Sized + Hash, H: Hasher + Default, Self: Default,

Implementors§