Struct sdsl::BitVector [−][src]
pub struct BitVector { /* fields omitted */ }
Expand description
Implementations
impl BitVector
[src]
impl BitVector
[src]pub fn new(size: usize, default_value: usize) -> Result<Self>
[src]
pub fn new(size: usize, default_value: usize) -> Result<Self>
[src]Construct a new bit vector.
Arguments
size
- Number of elements.default_value
- Default values for elements initialization.
pub fn capacity(&self) -> usize
[src]
pub fn capacity(&self) -> usize
[src]Returns the size of the occupied bits of the vector.
The capacity of a vector is greater or equal to the
bit_size()
.
pub fn get_int(&self, index: usize, len: u8) -> usize
[src]
pub fn get_int(&self, index: usize, len: u8) -> usize
[src]Get the integer value of the binary string of length len
starting at position index
in the vector.
Arguments
index
- Starting index of the binary representation of the integer.len
- Length of the binary representation of the integer.
Example
ⓘ
// 1, 2, 4, 8, 16 let bv = sdsl::bit_vector! {1, 1, 0, 0, 1}; let result = bv.get_int(0, 5); let expected = 19; // = 1 + 2 + 16 assert_eq!(result, expected);
pub fn set_int(&mut self, index: usize, value: usize, len: u8)
[src]
pub fn set_int(&mut self, index: usize, value: usize, len: u8)
[src]Set the bits from position index
to index+len-1
to the binary representation of integer value
.
The bit at position index
represents the least significant bit (lsb), and the bit at
position index+len-1
the most significant bit (msb) of value
.
Arguments
index
- Starting index of the binary representation ofvalue
.value
- The integer to store in the vector.len
- The length used to storevalue
in the vector.
Trait Implementations
impl IntoIterator for BitVector
[src]
impl IntoIterator for BitVector
[src]impl Eq for BitVector
[src]
Auto Trait Implementations
impl RefUnwindSafe for BitVector
impl !Send for BitVector
impl !Sync for BitVector
impl Unpin for BitVector
impl UnwindSafe for BitVector
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more