pub enum BitSize {
Field,
Integer(IntegerBitSize),
}Expand description
Represents the bit size of values in Brillig.
Values can either be field elements (whose size depends on the field being used) or fixed-size unsigned integers.
Variants§
Field
Integer(IntegerBitSize)
Implementations§
Source§impl BitSize
impl BitSize
Sourcepub fn to_u32<F: AcirField>(self) -> u32
pub fn to_u32<F: AcirField>(self) -> u32
Convert the bit size to a u32 value.
For field elements, returns the maximum number of bits in the field. For integers, returns the bit size of the integer type.
Sourcepub fn try_from_u32<F: AcirField>(value: u32) -> Result<Self, &'static str>
pub fn try_from_u32<F: AcirField>(value: u32) -> Result<Self, &'static str>
Try to create a BitSize from a u32 value.
If the value matches the field’s maximum bit count, returns BitSize::Field.
Otherwise, attempts to interpret it as an integer bit size.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for BitSize
impl<'de> Deserialize<'de> for BitSize
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for BitSize
impl Ord for BitSize
Source§impl PartialOrd for BitSize
impl PartialOrd for BitSize
impl Copy for BitSize
impl Eq for BitSize
impl StructuralPartialEq for BitSize
Auto Trait Implementations§
impl Freeze for BitSize
impl RefUnwindSafe for BitSize
impl Send for BitSize
impl Sync for BitSize
impl Unpin for BitSize
impl UnwindSafe for BitSize
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more