pub struct HyperLogLog { /* private fields */ }Available on crate feature
nip45 only.Expand description
256-register HyperLogLog sketch as defined by NIP-45.
Implementations§
Source§impl HyperLogLog
impl HyperLogLog
Sourcepub const fn from_bytes(registers: &[u8; 256]) -> Self
pub const fn from_bytes(registers: &[u8; 256]) -> Self
Construct a sketch from a register array.
Sourcepub fn from_hex(hex_str: &str) -> Result<Self, CountError>
pub fn from_hex(hex_str: &str) -> Result<Self, CountError>
Parse a 512-character hex sketch.
§Errors
Returns CountError::HllLength when the input is not 512
characters or CountError::HllHex for non-hex input.
Sourcepub fn observe(&mut self, offset: usize, hash: &[u8; 32]) -> bool
pub fn observe(&mut self, offset: usize, hash: &[u8; 32]) -> bool
Apply an event ID / pubkey to the sketch using the supplied
offset (see hll_offset_for_value).
Returns false when offset falls outside the spec’s 8..=23
range, leaving the sketch untouched.
Trait Implementations§
Source§impl Clone for HyperLogLog
impl Clone for HyperLogLog
Source§fn clone(&self) -> HyperLogLog
fn clone(&self) -> HyperLogLog
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for HyperLogLog
Source§impl Debug for HyperLogLog
impl Debug for HyperLogLog
Source§impl Default for HyperLogLog
impl Default for HyperLogLog
impl Eq for HyperLogLog
Source§impl PartialEq for HyperLogLog
impl PartialEq for HyperLogLog
impl StructuralPartialEq for HyperLogLog
Auto Trait Implementations§
impl Freeze for HyperLogLog
impl RefUnwindSafe for HyperLogLog
impl Send for HyperLogLog
impl Sync for HyperLogLog
impl Unpin for HyperLogLog
impl UnsafeUnpin for HyperLogLog
impl UnwindSafe for HyperLogLog
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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
Compare self to
key and return true if they are equal.