Skip to main content

FromBits

Trait 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§

Source

fn from_bits_le(bits: &[bool]) -> Result<Self, Error>

Reads Self from a boolean array in little-endian order.

Source

fn from_bits_be(bits: &[bool]) -> Result<Self, Error>

Reads Self from a boolean array in big-endian order.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<E> FromBits for Scalar<E>
where E: Environment,

Source§

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 than E::Scalar::size_in_bits(), the excess bits are enforced to be 0s.
  • If bits_le is shorter than E::Scalar::size_in_bits(), it is padded with 0s up to scalar size.
Source§

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.

Implementors§

Source§

impl<E> FromBits for Boolean<E>
where E: Environment,

Source§

impl<E> FromBits for Field<E>
where E: Environment,

Source§

impl<E, I> FromBits for Integer<E, I>
where E: Environment, I: IntegerType,

Source§

impl<E: Environment> FromBits for IdentifierLiteral<E>