[][src]Struct multiproof_rs::keys::binary_key::BinaryKey

pub struct BinaryKey(_, _, _);

Represents a key whose basic unit is the bit. This is meant to be used at the key in binary trees.

Bits are stored inside an array of bytes, and are read left to right. The structure also contains the start and end offset of the bit field.

Example structure

The following code will create a bit field with 6 bits spread over two integers.

use multiproof_rs::keys::BinaryKey;
let bitkey = BinaryKey::new(vec![0x55; 2], 3, 6);

The internal representation is therefore:

byte #    |     1        2
bit  #    | 76543210 76543210
----------+------------------
bit value | 01010101 01010101
offsets   |     ^     ^
          |   start  end

Methods

impl BinaryKey[src]

pub fn new(data: Vec<u8>, start: usize, end: usize) -> Self[src]

Trait Implementations

impl Clone for BinaryKey[src]

impl Debug for BinaryKey[src]

impl<'_> From<&'_ [u8]> for BinaryKey[src]

impl From<Vec<u8>> for BinaryKey[src]

impl Index<usize> for BinaryKey[src]

type Output = u8

The returned type after indexing.

impl Key<u8> for BinaryKey[src]

impl PartialEq<BinaryKey> for BinaryKey[src]

impl StructuralPartialEq for BinaryKey[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.