pub struct Digest<const N: usize = 1>(/* private fields */);Expand description
A fixed-size rolling hash of an append-only history, usable as a cheap, allocation-free
Game::Infoset key.
Unlike History it keeps no structure – only N independent 64-bit hash lanes – so it is
Copy and every operation is O(N) with no heap allocation. The trade-off is that it is
lossy: two distinct histories whose digests collide become the same infoset, silently merging
their regret.
N picks that trade-off. Each lane is its own rolling hash, salted by its index, so a collision
needs all N lanes to coincide at once – roughly a 2^(64*N) chance. The default Digest<1>
is most compact but a collision grows likely as the distinct-history count approaches 2^32;
Digest<2> pushes that to 2^64 (negligible at any feasible game size) and Digest<4> further
still, each lane costing 8 more bytes of key. Prefer any of them only for astronomically large
games where avoiding allocation matters more than the residual risk; otherwise use the exact
History.
Implementations§
Trait Implementations§
impl<const N: usize> Copy for Digest<N>
impl<const N: usize> Eq for Digest<N>
impl<const N: usize> StructuralPartialEq for Digest<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for Digest<N>
impl<const N: usize> RefUnwindSafe for Digest<N>
impl<const N: usize> Send for Digest<N>
impl<const N: usize> Sync for Digest<N>
impl<const N: usize> Unpin for Digest<N>
impl<const N: usize> UnsafeUnpin for Digest<N>
impl<const N: usize> UnwindSafe for Digest<N>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more