Trait snarkvm_console_program::environment::prelude::ToBits
source · pub trait ToBits: Sized {
// Required methods
fn write_bits_le(&self, vec: &mut Vec<bool>);
fn write_bits_be(&self, vec: &mut Vec<bool>);
// Provided methods
fn to_bits_le(&self) -> Vec<bool> { ... }
fn to_bits_be(&self) -> Vec<bool> { ... }
fn num_bits() -> Option<usize> { ... }
}
Required Methods§
sourcefn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
Writes self
into the given vector as a boolean array in little-endian order.
sourcefn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
Writes self
into the given vector as a boolean array in big-endian order.
Provided Methods§
sourcefn to_bits_le(&self) -> Vec<bool>
fn to_bits_le(&self) -> Vec<bool>
Returns self
as a boolean array in little-endian order.
sourcefn to_bits_be(&self) -> Vec<bool>
fn to_bits_be(&self) -> Vec<bool>
Returns self
as a boolean array in big-endian order.
Object Safety§
Implementations on Foreign Types§
source§impl ToBits for bool
impl ToBits for bool
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits.
source§impl ToBits for String
impl ToBits for String
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits.
source§impl<'a, C0, C1> ToBits for &'a (C0, C1)where
C0: ToBits,
C1: ToBits,
impl<'a, C0, C1> ToBits for &'a (C0, C1)where C0: ToBits, C1: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<'a, C0, C1, C2> ToBits for &'a (C0, C1, C2)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
impl<'a, C0, C1, C2> ToBits for &'a (C0, C1, C2)where C0: ToBits, C1: ToBits, C2: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<'a, C0, C1, C2, C3> ToBits for &'a (C0, C1, C2, C3)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
impl<'a, C0, C1, C2, C3> ToBits for &'a (C0, C1, C2, C3)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<'a, C0, C1, C2, C3, C4> ToBits for &'a (C0, C1, C2, C3, C4)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
impl<'a, C0, C1, C2, C3, C4> ToBits for &'a (C0, C1, C2, C3, C4)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<'a, C0, C1, C2, C3, C4, C5> ToBits for &'a (C0, C1, C2, C3, C4, C5)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
C5: ToBits,
impl<'a, C0, C1, C2, C3, C4, C5> ToBits for &'a (C0, C1, C2, C3, C4, C5)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits, C5: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<'a, C0, C1, C2, C3, C4, C5, C6> ToBits for &'a (C0, C1, C2, C3, C4, C5, C6)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
C5: ToBits,
C6: ToBits,
impl<'a, C0, C1, C2, C3, C4, C5, C6> ToBits for &'a (C0, C1, C2, C3, C4, C5, C6)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits, C5: ToBits, C6: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<'a, C0, C1, C2, C3, C4, C5, C6, C7> ToBits for &'a (C0, C1, C2, C3, C4, C5, C6, C7)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
C5: ToBits,
C6: ToBits,
C7: ToBits,
impl<'a, C0, C1, C2, C3, C4, C5, C6, C7> ToBits for &'a (C0, C1, C2, C3, C4, C5, C6, C7)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits, C5: ToBits, C6: ToBits, C7: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<'a, C0, C1, C2, C3, C4, C5, C6, C7, C8> ToBits for &'a (C0, C1, C2, C3, C4, C5, C6, C7, C8)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
C5: ToBits,
C6: ToBits,
C7: ToBits,
C8: ToBits,
impl<'a, C0, C1, C2, C3, C4, C5, C6, C7, C8> ToBits for &'a (C0, C1, C2, C3, C4, C5, C6, C7, C8)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits, C5: ToBits, C6: ToBits, C7: ToBits, C8: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<'a, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> ToBits for &'a (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
C5: ToBits,
C6: ToBits,
C7: ToBits,
C8: ToBits,
C9: ToBits,
impl<'a, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> ToBits for &'a (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits, C5: ToBits, C6: ToBits, C7: ToBits, C8: ToBits, C9: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<'a, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> ToBits for &'a (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
C5: ToBits,
C6: ToBits,
C7: ToBits,
C8: ToBits,
C9: ToBits,
C10: ToBits,
impl<'a, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> ToBits for &'a (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits, C5: ToBits, C6: ToBits, C7: ToBits, C8: ToBits, C9: ToBits, C10: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<C0, C1> ToBits for (C0, C1)where
C0: ToBits,
C1: ToBits,
impl<C0, C1> ToBits for (C0, C1)where C0: ToBits, C1: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<C0, C1, C2> ToBits for (C0, C1, C2)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
impl<C0, C1, C2> ToBits for (C0, C1, C2)where C0: ToBits, C1: ToBits, C2: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<C0, C1, C2, C3> ToBits for (C0, C1, C2, C3)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
impl<C0, C1, C2, C3> ToBits for (C0, C1, C2, C3)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<C0, C1, C2, C3, C4> ToBits for (C0, C1, C2, C3, C4)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
impl<C0, C1, C2, C3, C4> ToBits for (C0, C1, C2, C3, C4)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<C0, C1, C2, C3, C4, C5> ToBits for (C0, C1, C2, C3, C4, C5)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
C5: ToBits,
impl<C0, C1, C2, C3, C4, C5> ToBits for (C0, C1, C2, C3, C4, C5)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits, C5: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<C0, C1, C2, C3, C4, C5, C6> ToBits for (C0, C1, C2, C3, C4, C5, C6)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
C5: ToBits,
C6: ToBits,
impl<C0, C1, C2, C3, C4, C5, C6> ToBits for (C0, C1, C2, C3, C4, C5, C6)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits, C5: ToBits, C6: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<C0, C1, C2, C3, C4, C5, C6, C7> ToBits for (C0, C1, C2, C3, C4, C5, C6, C7)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
C5: ToBits,
C6: ToBits,
C7: ToBits,
impl<C0, C1, C2, C3, C4, C5, C6, C7> ToBits for (C0, C1, C2, C3, C4, C5, C6, C7)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits, C5: ToBits, C6: ToBits, C7: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<C0, C1, C2, C3, C4, C5, C6, C7, C8> ToBits for (C0, C1, C2, C3, C4, C5, C6, C7, C8)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
C5: ToBits,
C6: ToBits,
C7: ToBits,
C8: ToBits,
impl<C0, C1, C2, C3, C4, C5, C6, C7, C8> ToBits for (C0, C1, C2, C3, C4, C5, C6, C7, C8)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits, C5: ToBits, C6: ToBits, C7: ToBits, C8: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> ToBits for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
C5: ToBits,
C6: ToBits,
C7: ToBits,
C8: ToBits,
C9: ToBits,
impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9> ToBits for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits, C5: ToBits, C6: ToBits, C7: ToBits, C8: ToBits, C9: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> ToBits for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)where
C0: ToBits,
C1: ToBits,
C2: ToBits,
C3: ToBits,
C4: ToBits,
C5: ToBits,
C6: ToBits,
C7: ToBits,
C8: ToBits,
C9: ToBits,
C10: ToBits,
impl<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10> ToBits for (C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)where C0: ToBits, C1: ToBits, C2: ToBits, C3: ToBits, C4: ToBits, C5: ToBits, C6: ToBits, C7: ToBits, C8: ToBits, C9: ToBits, C10: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits from the circuits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits from the circuits.
source§impl<C> ToBits for &[C]where
C: ToBits,
impl<C> ToBits for &[C]where C: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits.
source§impl<C> ToBits for Vec<C>where
C: ToBits,
impl<C> ToBits for Vec<C>where C: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits.
source§impl<C, const N: usize> ToBits for [C; N]where
C: ToBits,
impl<C, const N: usize> ToBits for [C; N]where C: ToBits,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of little-endian bits.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
A helper method to return a concatenated list of big-endian bits.
source§impl<N> ToBits for ComputeKey<N>where
N: Network,
impl<N> ToBits for ComputeKey<N>where N: Network,
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
Returns the little-endian bits of the compute key.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
Returns the big-endian bits of the compute key.