pub struct Boolean<E: Environment>(/* private fields */);
Implementations§
Source§impl<E: Environment> Boolean<E>
impl<E: Environment> Boolean<E>
Sourcepub fn from_variable(var: Variable<E::BaseField>) -> Self
pub fn from_variable(var: Variable<E::BaseField>) -> Self
Initializes a boolean from a variable.
Note: This method does not check the booleanity of the variable.
Methods from Deref<Target = LinearCombination<E::BaseField>>§
Sourcepub fn is_constant(&self) -> bool
pub fn is_constant(&self) -> bool
Returns true
if there are no terms in the linear combination.
Sourcepub fn is_public(&self) -> bool
pub fn is_public(&self) -> bool
Returns true
if there is exactly one term with a coefficient of one,
and the term contains a public variable.
Sourcepub fn is_private(&self) -> bool
pub fn is_private(&self) -> bool
Returns true
if the linear combination is not constant or public.
Sourcepub fn is_boolean_type(&self) -> bool
pub fn is_boolean_type(&self) -> bool
Returns true
if the linear combination represents a Boolean
type,
and is well-formed.
Properties:
- Either
constant
orterms
is utilized, however never both. - Every individual variable in the linear combination must always be either
0
or1
. - The value of the linear combination must always be either
0
or1
.
Trait Implementations§
Source§impl<E: Environment> Adder for Boolean<E>
impl<E: Environment> Adder for Boolean<E>
Source§impl<E: Environment> BitAnd for Boolean<E>
impl<E: Environment> BitAnd for Boolean<E>
Source§impl<E: Environment> BitAndAssign<&Boolean<E>> for Boolean<E>
impl<E: Environment> BitAndAssign<&Boolean<E>> for Boolean<E>
Source§fn bitand_assign(&mut self, other: &Boolean<E>)
fn bitand_assign(&mut self, other: &Boolean<E>)
Sets self
as (self AND other)
.
Source§impl<E: Environment> BitAndAssign for Boolean<E>
impl<E: Environment> BitAndAssign for Boolean<E>
Source§fn bitand_assign(&mut self, other: Boolean<E>)
fn bitand_assign(&mut self, other: Boolean<E>)
Sets self
as (self AND other)
.
Source§impl<E: Environment> BitOr for Boolean<E>
impl<E: Environment> BitOr for Boolean<E>
Source§impl<E: Environment> BitOrAssign<&Boolean<E>> for Boolean<E>
impl<E: Environment> BitOrAssign<&Boolean<E>> for Boolean<E>
Source§fn bitor_assign(&mut self, other: &Boolean<E>)
fn bitor_assign(&mut self, other: &Boolean<E>)
Sets self
as (self OR other)
.
Source§impl<E: Environment> BitOrAssign for Boolean<E>
impl<E: Environment> BitOrAssign for Boolean<E>
Source§fn bitor_assign(&mut self, other: Boolean<E>)
fn bitor_assign(&mut self, other: Boolean<E>)
Sets self
as (self OR other)
.
Source§impl<E: Environment> BitXor for Boolean<E>
impl<E: Environment> BitXor for Boolean<E>
Source§impl<E: Environment> BitXorAssign<&Boolean<E>> for Boolean<E>
impl<E: Environment> BitXorAssign<&Boolean<E>> for Boolean<E>
Source§fn bitxor_assign(&mut self, other: &Boolean<E>)
fn bitxor_assign(&mut self, other: &Boolean<E>)
Sets self
as (self != other)
.
Source§impl<E: Environment> BitXorAssign for Boolean<E>
impl<E: Environment> BitXorAssign for Boolean<E>
Source§fn bitxor_assign(&mut self, other: Boolean<E>)
fn bitxor_assign(&mut self, other: Boolean<E>)
Sets self
as (self != other)
.
Source§impl<E: Environment> Debug for Boolean<E>
impl<E: Environment> Debug for Boolean<E>
Source§impl<E: Environment> Deref for Boolean<E>
impl<E: Environment> Deref for Boolean<E>
Source§type Target = LinearCombination<<E as Environment>::BaseField>
type Target = LinearCombination<<E as Environment>::BaseField>
Source§impl<E: Environment> Display for Boolean<E>
impl<E: Environment> Display for Boolean<E>
Source§impl<E: Environment> Eject for Boolean<E>
impl<E: Environment> Eject for Boolean<E>
Source§fn eject_mode(&self) -> Mode
fn eject_mode(&self) -> Mode
Ejects the mode of the boolean.
Source§fn eject_value(&self) -> Self::Primitive
fn eject_value(&self) -> Self::Primitive
Ejects the boolean as a constant boolean value.
type Primitive = bool
Source§fn eject(&self) -> (Mode, Self::Primitive)
fn eject(&self) -> (Mode, Self::Primitive)
Source§fn is_constant(&self) -> bool
fn is_constant(&self) -> bool
true
if the circuit is a constant.Source§fn is_private(&self) -> bool
fn is_private(&self) -> bool
true
if the circuit is a private.Source§impl<E: Environment> Equal for Boolean<E>
impl<E: Environment> Equal for Boolean<E>
Source§impl<E: Environment> From<&Boolean<E>> for LinearCombination<E::BaseField>
impl<E: Environment> From<&Boolean<E>> for LinearCombination<E::BaseField>
Source§impl<E: Environment> From<Boolean<E>> for LinearCombination<E::BaseField>
impl<E: Environment> From<Boolean<E>> for LinearCombination<E::BaseField>
Source§impl<E: Environment> FromBits for Boolean<E>
impl<E: Environment> FromBits for Boolean<E>
Source§impl<E: Environment> FromStr for Boolean<E>
impl<E: Environment> FromStr for Boolean<E>
Source§impl<E: Environment> Inject for Boolean<E>
impl<E: Environment> Inject for Boolean<E>
Source§impl<E: Environment> Nand for Boolean<E>
impl<E: Environment> Nand for Boolean<E>
Source§impl<E: Environment> Nor for Boolean<E>
impl<E: Environment> Nor for Boolean<E>
Source§impl<E: Environment> Not for &Boolean<E>
impl<E: Environment> Not for &Boolean<E>
Source§impl<E: Environment> Not for Boolean<E>
impl<E: Environment> Not for Boolean<E>
Source§impl<E: Environment> OutputMode<dyn Nor<Boolean<E>, Output = Boolean<E>>> for Boolean<E>
impl<E: Environment> OutputMode<dyn Nor<Boolean<E>, Output = Boolean<E>>> for Boolean<E>
type Case = (CircuitType<Boolean<E>>, CircuitType<Boolean<E>>)
Source§fn output_mode(case: &Self::Case) -> Mode
fn output_mode(case: &Self::Case) -> Mode
Source§impl<E: Environment> OutputMode<dyn Not<Output = Boolean<E>>> for Boolean<E>
impl<E: Environment> OutputMode<dyn Not<Output = Boolean<E>>> for Boolean<E>
Source§impl<E: Environment> Parser for Boolean<E>
impl<E: Environment> Parser for Boolean<E>
Source§fn parse(string: &str) -> ParserResult<'_, Self>
fn parse(string: &str) -> ParserResult<'_, Self>
Parses a string into a boolean circuit.
Source§impl<E: Environment> Subtractor for Boolean<E>
impl<E: Environment> Subtractor for Boolean<E>
Source§fn subtractor(
&self,
other: &Self,
borrow: &Self,
) -> (Self::Difference, Self::Borrow)
fn subtractor( &self, other: &Self, borrow: &Self, ) -> (Self::Difference, Self::Borrow)
Returns the difference of self
and other
as a difference bit and borrow bit.
type Borrow = Boolean<E>
type Difference = Boolean<E>
Source§impl<E: Environment> Ternary for Boolean<E>
impl<E: Environment> Ternary for Boolean<E>
Source§impl<E: Environment> ToBits for &Boolean<E>
impl<E: Environment> ToBits for &Boolean<E>
Source§fn write_bits_le(&self, vec: &mut Vec<Self::Boolean>)
fn write_bits_le(&self, vec: &mut Vec<Self::Boolean>)
Outputs self
as a single-element vector.
Source§fn write_bits_be(&self, vec: &mut Vec<Self::Boolean>)
fn write_bits_be(&self, vec: &mut Vec<Self::Boolean>)
Outputs self
as a single-element vector.
type Boolean = Boolean<E>
Source§fn to_bits_le(&self) -> Vec<Self::Boolean>
fn to_bits_le(&self) -> Vec<Self::Boolean>
Source§fn to_bits_be(&self) -> Vec<Self::Boolean>
fn to_bits_be(&self) -> Vec<Self::Boolean>
Source§impl<E: Environment> ToBits for Boolean<E>
impl<E: Environment> ToBits for Boolean<E>
Source§fn write_bits_le(&self, vec: &mut Vec<Self::Boolean>)
fn write_bits_le(&self, vec: &mut Vec<Self::Boolean>)
Outputs self
as a single-element vector.
Source§fn write_bits_be(&self, vec: &mut Vec<Self::Boolean>)
fn write_bits_be(&self, vec: &mut Vec<Self::Boolean>)
Outputs self
as a single-element vector.
type Boolean = Boolean<E>
Source§fn to_bits_le(&self) -> Vec<Self::Boolean>
fn to_bits_le(&self) -> Vec<Self::Boolean>
Source§fn to_bits_be(&self) -> Vec<Self::Boolean>
fn to_bits_be(&self) -> Vec<Self::Boolean>
Source§impl<E: Environment> TypeName for Boolean<E>
impl<E: Environment> TypeName for Boolean<E>
impl<E: Environment> BooleanTrait for Boolean<E>
Auto Trait Implementations§
impl<E> Freeze for Boolean<E>
impl<E> RefUnwindSafe for Boolean<E>
impl<E> !Send for Boolean<E>
impl<E> !Sync for Boolean<E>
impl<E> Unpin for Boolean<E>
impl<E> UnwindSafe for Boolean<E>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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