Skip to main content

Bit

Struct Bit 

Source
#[repr(transparent)]
pub struct Bit(pub u8);

Tuple Fields§

§0: u8

Implementations§

Source§

impl Bit

Source

pub const fn new(val: u8) -> Self

Trait Implementations§

Source§

impl Add for Bit

Add (XOR) 0+0=0, 0+1=1, 1+0=1, 1+1=0

Source§

type Output = Bit

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign for Bit

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl CanonicalDeserialize for Bit

Source§

fn deserialize(bytes: &[u8]) -> Result<Self, ()>

Deserializes from a buffer. Returns Err if buffer is too short.
Source§

impl CanonicalSerialize for Bit

Source§

fn serialized_size(&self) -> usize

Returns the size in bytes.
Source§

fn serialize(&self, writer: &mut [u8]) -> Result<(), ()>

Serializes the element into a buffer. Returns error if buffer is too small.
Source§

fn to_bytes(&self) -> Vec<u8>

Convenience method: returns a Vec.
Source§

impl Clone for Bit

Source§

fn clone(&self) -> Bit

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Bit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Bit

Source§

fn default() -> Bit

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Bit

Source§

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 FlatPromote<Block8> for Bit

Source§

fn promote_flat(val: Flat<Block8>) -> Flat<Self>

Source§

fn promote_flat_batch(input: &[Flat<FromF>], output: &mut [Flat<Self>])

Batch promote a slice of flat elements. Read more
Source§

impl From<Bit> for Block128

Source§

fn from(val: Bit) -> Self

Converts to this type from the input type.
Source§

impl From<Bit> for Block16

Source§

fn from(val: Bit) -> Self

Converts to this type from the input type.
Source§

impl From<Bit> for Block32

Source§

fn from(val: Bit) -> Self

Converts to this type from the input type.
Source§

impl From<Bit> for Block64

Source§

fn from(val: Bit) -> Self

Converts to this type from the input type.
Source§

impl From<Bit> for Block8

Source§

fn from(val: Bit) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for Bit

Source§

fn from(val: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Bit

Source§

fn from(val: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Bit

Source§

fn from(val: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Bit

Source§

fn from(val: u8) -> Self

Converts to this type from the input type.
Source§

impl HardwareField for Bit

Source§

fn to_hardware(self) -> Flat<Self>

Convert standard Tower element to hardware basis (Isomorphic).
Source§

fn from_hardware(value: Flat<Self>) -> Self

Convert hardware element back to Tower basis.
Source§

fn add_hardware(lhs: Flat<Self>, rhs: Flat<Self>) -> Flat<Self>

Sum two elements assuming they are already in hardware basis.
Source§

fn add_hardware_packed( lhs: PackedFlat<Self>, rhs: PackedFlat<Self>, ) -> PackedFlat<Self>

Sum packed vectors in hardware basis.
Source§

fn mul_hardware(lhs: Flat<Self>, rhs: Flat<Self>) -> Flat<Self>

Multiply two elements assuming they are already in hardware basis.
Source§

fn mul_hardware_packed( lhs: PackedFlat<Self>, rhs: PackedFlat<Self>, ) -> PackedFlat<Self>

Multiply packed vectors in hardware basis.
Source§

fn mul_hardware_scalar_packed( lhs: PackedFlat<Self>, rhs: Flat<Self>, ) -> PackedFlat<Self>

Multiply packed vectors by a scalar in hardware basis.
Source§

fn tower_bit_from_hardware(value: Flat<Self>, bit_idx: usize) -> u8

Extracts the bit_idx bit of the canonical Tower representation directly from the Hardware (Flat) representation without a full basis conversion. Strictly constant time.
Source§

impl Mul<Bit> for PackedBit

Source§

type Output = PackedBit

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Bit) -> Self

Performs the * operation. Read more
Source§

impl Mul for Bit

Mul (AND) 00=0, 01=0, 1*1=1

Source§

type Output = Bit

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign for Bit

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl PackableField for Bit

Source§

const WIDTH: usize = PACKED_WIDTH_BIT

How many elements fit in one packed vector.
Source§

type Packed = PackedBit

The packed vector type (e.g., PackedBlock128).
Source§

fn pack(chunk: &[Self]) -> Self::Packed

Pack a slice of scalars into a vector. Panics if slice len < WIDTH.
Source§

fn unpack(packed: Self::Packed, output: &mut [Self])

Unpack vector back to scalars.
Source§

impl PartialEq for Bit

Source§

fn eq(&self, other: &Bit) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Bit

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Sub for Bit

Sub is the same as add

Source§

type Output = Bit

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign for Bit

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl TowerField for Bit

Source§

const BITS: usize = 1

Source§

const ZERO: Self

Source§

const ONE: Self

Source§

const EXTENSION_TAU: Self

The constant TAU needed to extend this field to the next level. If we are in F, then the next field F’ is constructed as F[X] / (X^2 + X + EXTENSION_TAU).
Source§

fn invert(&self) -> Self

Returns the multiplicative inverse of the element. By cryptographic convention, the inverse of 0 is defined as 0 to ensure constant-time execution without branching.
Source§

fn from_uniform_bytes(bytes: &[u8; 32]) -> Self

Constructs a field element from uniform bytes (e.g. hash output). Used for PRNG / Blinding. Read more
Source§

impl Zeroize for Bit

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
Source§

impl Copy for Bit

Source§

impl Eq for Bit

Source§

impl StructuralPartialEq for Bit

Auto Trait Implementations§

§

impl Freeze for Bit

§

impl RefUnwindSafe for Bit

§

impl Send for Bit

§

impl Sync for Bit

§

impl Unpin for Bit

§

impl UnsafeUnpin for Bit

§

impl UnwindSafe for Bit

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<F> FlatPromote<F> for F
where F: HardwareField,

Source§

fn promote_flat(val: Flat<F>) -> Flat<F>

Source§

fn promote_flat_batch(input: &[Flat<FromF>], output: &mut [Flat<Self>])

Batch promote a slice of flat elements. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,