Struct snarkvm_circuit_types_boolean::Boolean
source · pub struct Boolean<E: Environment>(_);
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
sourceimpl<E: Environment> Adder for Boolean<E>
impl<E: Environment> Adder for Boolean<E>
sourceimpl<E: Environment> BitAnd<&Boolean<E>> for &Boolean<E>
impl<E: Environment> BitAnd<&Boolean<E>> for &Boolean<E>
sourceimpl<E: Environment> BitAnd<&Boolean<E>> for Boolean<E>
impl<E: Environment> BitAnd<&Boolean<E>> for Boolean<E>
sourceimpl<E: Environment> BitAnd<Boolean<E>> for &Boolean<E>
impl<E: Environment> BitAnd<Boolean<E>> for &Boolean<E>
sourceimpl<E: Environment> BitAnd<Boolean<E>> for Boolean<E>
impl<E: Environment> BitAnd<Boolean<E>> for Boolean<E>
sourceimpl<E: Environment> BitAndAssign<&Boolean<E>> for Boolean<E>
impl<E: Environment> BitAndAssign<&Boolean<E>> for Boolean<E>
sourcefn bitand_assign(&mut self, other: &Boolean<E>)
fn bitand_assign(&mut self, other: &Boolean<E>)
Sets self
as (self AND other)
.
sourceimpl<E: Environment> BitAndAssign<Boolean<E>> for Boolean<E>
impl<E: Environment> BitAndAssign<Boolean<E>> for Boolean<E>
sourcefn bitand_assign(&mut self, other: Boolean<E>)
fn bitand_assign(&mut self, other: Boolean<E>)
Sets self
as (self AND other)
.
sourceimpl<E: Environment> BitOr<&Boolean<E>> for &Boolean<E>
impl<E: Environment> BitOr<&Boolean<E>> for &Boolean<E>
sourceimpl<E: Environment> BitOr<&Boolean<E>> for Boolean<E>
impl<E: Environment> BitOr<&Boolean<E>> for Boolean<E>
sourceimpl<E: Environment> BitOr<Boolean<E>> for &Boolean<E>
impl<E: Environment> BitOr<Boolean<E>> for &Boolean<E>
sourceimpl<E: Environment> BitOr<Boolean<E>> for Boolean<E>
impl<E: Environment> BitOr<Boolean<E>> for Boolean<E>
sourceimpl<E: Environment> BitOrAssign<&Boolean<E>> for Boolean<E>
impl<E: Environment> BitOrAssign<&Boolean<E>> for Boolean<E>
sourcefn bitor_assign(&mut self, other: &Boolean<E>)
fn bitor_assign(&mut self, other: &Boolean<E>)
Sets self
as (self OR other)
.
sourceimpl<E: Environment> BitOrAssign<Boolean<E>> for Boolean<E>
impl<E: Environment> BitOrAssign<Boolean<E>> for Boolean<E>
sourcefn bitor_assign(&mut self, other: Boolean<E>)
fn bitor_assign(&mut self, other: Boolean<E>)
Sets self
as (self OR other)
.
sourceimpl<E: Environment> BitXor<&Boolean<E>> for &Boolean<E>
impl<E: Environment> BitXor<&Boolean<E>> for &Boolean<E>
sourceimpl<E: Environment> BitXor<&Boolean<E>> for Boolean<E>
impl<E: Environment> BitXor<&Boolean<E>> for Boolean<E>
sourceimpl<E: Environment> BitXor<Boolean<E>> for &Boolean<E>
impl<E: Environment> BitXor<Boolean<E>> for &Boolean<E>
sourceimpl<E: Environment> BitXor<Boolean<E>> for Boolean<E>
impl<E: Environment> BitXor<Boolean<E>> for Boolean<E>
sourceimpl<E: Environment> BitXorAssign<&Boolean<E>> for Boolean<E>
impl<E: Environment> BitXorAssign<&Boolean<E>> for Boolean<E>
sourcefn bitxor_assign(&mut self, other: &Boolean<E>)
fn bitxor_assign(&mut self, other: &Boolean<E>)
Sets self
as (self != other)
.
sourceimpl<E: Environment> BitXorAssign<Boolean<E>> for Boolean<E>
impl<E: Environment> BitXorAssign<Boolean<E>> for Boolean<E>
sourcefn bitxor_assign(&mut self, other: Boolean<E>)
fn bitxor_assign(&mut self, other: Boolean<E>)
Sets self
as (self != other)
.
sourceimpl<E: Environment> Debug for Boolean<E>
impl<E: Environment> Debug for Boolean<E>
sourceimpl<E: Environment> Deref for Boolean<E>
impl<E: Environment> Deref for Boolean<E>
type Target = LinearCombination<<E as Environment>::BaseField>
type Target = LinearCombination<<E as Environment>::BaseField>
sourceimpl<E: Environment> Display for Boolean<E>
impl<E: Environment> Display for Boolean<E>
sourceimpl<E: Environment> Eject for Boolean<E>
impl<E: Environment> Eject for Boolean<E>
sourcefn eject_mode(&self) -> Mode
fn eject_mode(&self) -> Mode
Ejects the mode of the boolean.
sourcefn eject_value(&self) -> Self::Primitive
fn eject_value(&self) -> Self::Primitive
Ejects the boolean as a constant boolean value.
type Primitive = bool
sourcefn eject(&self) -> (Mode, Self::Primitive)
fn eject(&self) -> (Mode, Self::Primitive)
sourcefn is_constant(&self) -> bool
fn is_constant(&self) -> bool
true
if the circuit is a constant. Read moresourcefn is_private(&self) -> bool
fn is_private(&self) -> bool
true
if the circuit is a private. Read moresourceimpl<E: Environment> Equal<Boolean<E>> for Boolean<E>
impl<E: Environment> Equal<Boolean<E>> for Boolean<E>
sourceimpl<E: Environment> From<&Boolean<E>> for LinearCombination<E::BaseField>
impl<E: Environment> From<&Boolean<E>> for LinearCombination<E::BaseField>
sourceimpl<E: Environment> From<Boolean<E>> for LinearCombination<E::BaseField>
impl<E: Environment> From<Boolean<E>> for LinearCombination<E::BaseField>
sourceimpl<E: Environment> FromBits for Boolean<E>
impl<E: Environment> FromBits for Boolean<E>
sourcefn from_bits_le(bits_le: &[Self::Boolean]) -> Self
fn from_bits_le(bits_le: &[Self::Boolean]) -> Self
Returns a boolean circuit given a mode and single boolean.
sourcefn from_bits_be(bits_be: &[Self::Boolean]) -> Self
fn from_bits_be(bits_be: &[Self::Boolean]) -> Self
Returns a boolean circuit given a mode and single boolean.
type Boolean = Boolean<E>
sourceimpl<E: Environment> FromStr for Boolean<E>
impl<E: Environment> FromStr for Boolean<E>
sourceimpl<E: Environment> Inject for Boolean<E>
impl<E: Environment> Inject for Boolean<E>
sourceimpl<E: Environment> Metrics<dyn Nor<Boolean<E>, Output = Boolean<E>> + 'static> for Boolean<E>
impl<E: Environment> Metrics<dyn Nor<Boolean<E>, Output = Boolean<E>> + 'static> for Boolean<E>
sourceimpl<E: Environment> Nand<Boolean<E>> for Boolean<E>
impl<E: Environment> Nand<Boolean<E>> for Boolean<E>
sourceimpl<E: Environment> Nor<Boolean<E>> for Boolean<E>
impl<E: Environment> Nor<Boolean<E>> for Boolean<E>
sourceimpl<E: Environment> Not for &Boolean<E>
impl<E: Environment> Not for &Boolean<E>
sourceimpl<E: Environment> Not for Boolean<E>
impl<E: Environment> Not for Boolean<E>
sourceimpl<E: Environment> OutputMode<dyn Nor<Boolean<E>, Output = Boolean<E>> + 'static> for Boolean<E>
impl<E: Environment> OutputMode<dyn Nor<Boolean<E>, Output = Boolean<E>> + 'static> for Boolean<E>
type Case = (CircuitType<Boolean<E>>, CircuitType<Boolean<E>>)
sourcefn output_mode(case: &Self::Case) -> Mode
fn output_mode(case: &Self::Case) -> Mode
sourceimpl<E: Environment> OutputMode<dyn Not<Output = Boolean<E>> + 'static> for Boolean<E>
impl<E: Environment> OutputMode<dyn Not<Output = Boolean<E>> + 'static> for Boolean<E>
sourceimpl<E: Environment> Parser for Boolean<E>
impl<E: Environment> Parser for Boolean<E>
sourceimpl<E: Environment> Subtractor for Boolean<E>
impl<E: Environment> Subtractor for Boolean<E>
sourcefn 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>
sourceimpl<E: Environment> Ternary for Boolean<E>
impl<E: Environment> Ternary for Boolean<E>
sourceimpl<E: Environment> ToBits for &Boolean<E>
impl<E: Environment> ToBits for &Boolean<E>
sourcefn to_bits_le(&self) -> Vec<Self::Boolean>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
fn to_bits_le(&self) -> Vec<Self::Boolean>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Outputs self
as a single-element vector.
sourcefn to_bits_be(&self) -> Vec<Self::Boolean>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
fn to_bits_be(&self) -> Vec<Self::Boolean>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Outputs self
as a single-element vector.
type Boolean = Boolean<E>
sourceimpl<E: Environment> ToBits for Boolean<E>
impl<E: Environment> ToBits for Boolean<E>
sourcefn to_bits_le(&self) -> Vec<Self::Boolean>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
fn to_bits_le(&self) -> Vec<Self::Boolean>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Outputs self
as a single-element vector.
sourcefn to_bits_be(&self) -> Vec<Self::Boolean>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
fn to_bits_be(&self) -> Vec<Self::Boolean>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Outputs self
as a single-element vector.