Trait snarkvm_console_network::prelude::traits::FromBits
source · pub trait FromBits: Sized {
// Required methods
fn from_bits_le(bits: &[bool]) -> Result<Self, Error>;
fn from_bits_be(bits: &[bool]) -> Result<Self, Error>;
}
Required Methods§
sourcefn from_bits_le(bits: &[bool]) -> Result<Self, Error>
fn from_bits_le(bits: &[bool]) -> Result<Self, Error>
Reads Self
from a boolean array in little-endian order.
sourcefn from_bits_be(bits: &[bool]) -> Result<Self, Error>
fn from_bits_be(bits: &[bool]) -> Result<Self, Error>
Reads Self
from a boolean array in big-endian order.
Implementations on Foreign Types§
§impl<E> FromBits for Field<E>where
E: Environment,
impl<E> FromBits for Field<E>where E: Environment,
§fn from_bits_le(bits_le: &[bool]) -> Result<Field<E>, Error>
fn from_bits_le(bits_le: &[bool]) -> Result<Field<E>, Error>
Initializes a new field from a list of little-endian bits.
- If
bits_le
is longer thanE::Field::size_in_bits()
, the excess bits are enforced to be0
s. - If
bits_le
is shorter thanE::Field::size_in_bits()
, it is padded with0
s up to field size.
§fn from_bits_be(bits_be: &[bool]) -> Result<Field<E>, Error>
fn from_bits_be(bits_be: &[bool]) -> Result<Field<E>, Error>
Initializes a new field from a list of big-endian bits without leading zeros.
§impl<E> FromBits for Boolean<E>where
E: Environment,
impl<E> FromBits for Boolean<E>where E: Environment,
§fn from_bits_le(bits_le: &[bool]) -> Result<Boolean<E>, Error>
fn from_bits_le(bits_le: &[bool]) -> Result<Boolean<E>, Error>
Initializes a new boolean by extracting the first bit from a list of length 1.
§fn from_bits_be(bits_be: &[bool]) -> Result<Boolean<E>, Error>
fn from_bits_be(bits_be: &[bool]) -> Result<Boolean<E>, Error>
Initializes a new boolean by extracting the first bit from a list of length 1.
§impl<E> FromBits for Group<E>where
E: Environment,
impl<E> FromBits for Group<E>where E: Environment,
§fn from_bits_le(bits_le: &[bool]) -> Result<Group<E>, Error>
fn from_bits_le(bits_le: &[bool]) -> Result<Group<E>, Error>
Initializes a new group by recovering the x-coordinate of an affine group from a list of little-endian bits.
§fn from_bits_be(bits_be: &[bool]) -> Result<Group<E>, Error>
fn from_bits_be(bits_be: &[bool]) -> Result<Group<E>, Error>
Initializes a new group by recovering the x-coordinate of an affine group from a list of big-endian bits.
§impl<E> FromBits for Scalar<E>where
E: Environment,
impl<E> FromBits for Scalar<E>where E: Environment,
§fn from_bits_le(bits_le: &[bool]) -> Result<Scalar<E>, Error>
fn from_bits_le(bits_le: &[bool]) -> Result<Scalar<E>, Error>
Initializes a new scalar from a list of little-endian bits.
- If
bits_le
is longer thanE::Scalar::size_in_bits()
, the excess bits are enforced to be0
s. - If
bits_le
is shorter thanE::Scalar::size_in_bits()
, it is padded with0
s up to scalar size.
§fn from_bits_be(bits_be: &[bool]) -> Result<Scalar<E>, Error>
fn from_bits_be(bits_be: &[bool]) -> Result<Scalar<E>, Error>
Initializes a new scalar from a list of big-endian bits without leading zeros.
§impl<E, I> FromBits for Integer<E, I>where
E: Environment,
I: IntegerType,
impl<E, I> FromBits for Integer<E, I>where E: Environment, I: IntegerType,
§fn from_bits_le(bits_le: &[bool]) -> Result<Integer<E, I>, Error>
fn from_bits_le(bits_le: &[bool]) -> Result<Integer<E, I>, Error>
Initializes a new integer from a list of little-endian bits.
§fn from_bits_be(bits_be: &[bool]) -> Result<Integer<E, I>, Error>
fn from_bits_be(bits_be: &[bool]) -> Result<Integer<E, I>, Error>
Initializes a new integer from a list of big-endian bits.