Struct ValueVec

Source
pub struct ValueVec { /* private fields */ }
Expand description

A ValueVec is a bit vector that holds fixed sized unsigned integer values.

Implementations§

Source§

impl ValueVec

Source

pub fn new(bits_per_val: usize, count: usize) -> ValueVec

Create a ValueVec that holds values with bits_per_val bits and space to hold count values.

Source

pub fn with_max(max_val: u32, count: usize) -> ValueVec

Create a ValueVec that can hold count values where the maximam value of each entry is at least max_val (inclusive)

§Example
use bloom::ValueVec;
let mut vv = ValueVec::with_max(7,3);
vv.set(0,7); // okay
vv.set(0,8); // will panic
Source

pub fn bits_per_val(&self) -> usize

How many bits this ValueVec is using to store each value

Source

pub fn max_value(&self) -> u32

The maximum value this ValueVec can hold per entry

Source

pub fn clear(&mut self)

Resets all values to 0 in this ValueVec

Source

pub fn len(&self) -> usize

Get the total number of bits this valuevec is using

Source

pub fn set(&mut self, i: usize, val: u32)

Set value at index i to value val.

§Panics

Panics if val needs more bits to store than the number of bits this vec is using per value

Source

pub fn get(&self, i: usize) -> u32

Get the value in this ValueVec stored at index i

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.