pub struct Bloom(u128);Expand description
128-bit bloom filter (k=2 hashes) of items a peer supports.
Content-agnostic: items can be protocol ids, swarm keys, or any other identifier hashable as bytes. Discovery-layer hint, not an authoritative list.
Tuple Fields§
§0: u128Implementations§
Source§impl Bloom
impl Bloom
Sourcepub fn may_contain<I: AsRef<[u8]>>(&self, item: I) -> bool
pub fn may_contain<I: AsRef<[u8]>>(&self, item: I) -> bool
True if this filter might contain item.
Sourcepub fn covers(&self, other: &Self) -> bool
pub fn covers(&self, other: &Self) -> bool
True if every bit set in other is also set in self.
An empty other is always covered.
Sourcepub fn intersects(&self, other: &Self) -> bool
pub fn intersects(&self, other: &Self) -> bool
True if self and other share at least one bit.
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for Bloom
impl<'__de, __Context> BorrowDecode<'__de, __Context> for Bloom
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
impl Copy for Bloom
impl Eq for Bloom
impl StructuralPartialEq for Bloom
Auto Trait Implementations§
impl Freeze for Bloom
impl RefUnwindSafe for Bloom
impl Send for Bloom
impl Sync for Bloom
impl Unpin for Bloom
impl UnsafeUnpin for Bloom
impl UnwindSafe for Bloom
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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