Struct snarkvm_circuit::Boolean
pub struct Boolean<E>(_)
where
E: Environment;
Methods from Deref<Target = LinearCombination<<E as Environment>::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§
§impl<E> Adder for Boolean<E>where
E: Environment,
impl<E> Adder for Boolean<E>where E: Environment,
§impl<E> BitAnd<&Boolean<E>> for &Boolean<E>where
E: Environment,
impl<E> BitAnd<&Boolean<E>> for &Boolean<E>where E: Environment,
§impl<E> BitAnd<&Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> BitAnd<&Boolean<E>> for Boolean<E>where E: Environment,
§impl<E> BitAnd<Boolean<E>> for &Boolean<E>where
E: Environment,
impl<E> BitAnd<Boolean<E>> for &Boolean<E>where E: Environment,
§impl<E> BitAnd<Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> BitAnd<Boolean<E>> for Boolean<E>where E: Environment,
§impl<E> BitAndAssign<&Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> BitAndAssign<&Boolean<E>> for Boolean<E>where E: Environment,
§fn bitand_assign(&mut self, other: &Boolean<E>)
fn bitand_assign(&mut self, other: &Boolean<E>)
Sets self
as (self AND other)
.
§impl<E> BitAndAssign<Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> BitAndAssign<Boolean<E>> for Boolean<E>where E: Environment,
§fn bitand_assign(&mut self, other: Boolean<E>)
fn bitand_assign(&mut self, other: Boolean<E>)
Sets self
as (self AND other)
.
§impl<E> BitOr<&Boolean<E>> for &Boolean<E>where
E: Environment,
impl<E> BitOr<&Boolean<E>> for &Boolean<E>where E: Environment,
§impl<E> BitOr<&Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> BitOr<&Boolean<E>> for Boolean<E>where E: Environment,
§impl<E> BitOr<Boolean<E>> for &Boolean<E>where
E: Environment,
impl<E> BitOr<Boolean<E>> for &Boolean<E>where E: Environment,
§impl<E> BitOr<Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> BitOr<Boolean<E>> for Boolean<E>where E: Environment,
§impl<E> BitOrAssign<&Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> BitOrAssign<&Boolean<E>> for Boolean<E>where E: Environment,
§fn bitor_assign(&mut self, other: &Boolean<E>)
fn bitor_assign(&mut self, other: &Boolean<E>)
Sets self
as (self OR other)
.
§impl<E> BitOrAssign<Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> BitOrAssign<Boolean<E>> for Boolean<E>where E: Environment,
§fn bitor_assign(&mut self, other: Boolean<E>)
fn bitor_assign(&mut self, other: Boolean<E>)
Sets self
as (self OR other)
.
§impl<E> BitXor<&Boolean<E>> for &Boolean<E>where
E: Environment,
impl<E> BitXor<&Boolean<E>> for &Boolean<E>where E: Environment,
§impl<E> BitXor<&Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> BitXor<&Boolean<E>> for Boolean<E>where E: Environment,
§impl<E> BitXor<Boolean<E>> for &Boolean<E>where
E: Environment,
impl<E> BitXor<Boolean<E>> for &Boolean<E>where E: Environment,
§impl<E> BitXor<Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> BitXor<Boolean<E>> for Boolean<E>where E: Environment,
§impl<E> BitXorAssign<&Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> BitXorAssign<&Boolean<E>> for Boolean<E>where E: Environment,
§fn bitxor_assign(&mut self, other: &Boolean<E>)
fn bitxor_assign(&mut self, other: &Boolean<E>)
Sets self
as (self != other)
.
§impl<E> BitXorAssign<Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> BitXorAssign<Boolean<E>> for Boolean<E>where E: Environment,
§fn bitxor_assign(&mut self, other: Boolean<E>)
fn bitxor_assign(&mut self, other: Boolean<E>)
Sets self
as (self != other)
.
§impl<E> Clone for Boolean<E>where
E: Clone + Environment,
<E as Environment>::BaseField: Clone,
impl<E> Clone for Boolean<E>where E: Clone + Environment, <E as Environment>::BaseField: Clone,
§impl<E> Debug for Boolean<E>where
E: Environment,
impl<E> Debug for Boolean<E>where E: Environment,
§impl<E> Deref for Boolean<E>where
E: Environment,
impl<E> Deref for Boolean<E>where E: Environment,
§type Target = LinearCombination<<E as Environment>::BaseField>
type Target = LinearCombination<<E as Environment>::BaseField>
§impl<E> Display for Boolean<E>where
E: Environment,
impl<E> Display for Boolean<E>where E: Environment,
§impl<E> Eject for Boolean<E>where
E: Environment,
impl<E> Eject for Boolean<E>where E: Environment,
§fn eject_mode(&self) -> Mode
fn eject_mode(&self) -> Mode
Ejects the mode of the boolean.
§fn eject_value(&self) -> <Boolean<E> as Eject>::Primitive
fn eject_value(&self) -> <Boolean<E> as Eject>::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.§impl<E> Equal<Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> Equal<Boolean<E>> for Boolean<E>where E: Environment,
§impl<E> From<&Boolean<E>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
impl<E> From<&Boolean<E>> for LinearCombination<<E as Environment>::BaseField>where E: Environment,
§fn from(
boolean: &Boolean<E>
) -> LinearCombination<<E as Environment>::BaseField>
fn from( boolean: &Boolean<E> ) -> LinearCombination<<E as Environment>::BaseField>
§impl<E> From<Boolean<E>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
impl<E> From<Boolean<E>> for LinearCombination<<E as Environment>::BaseField>where E: Environment,
§fn from(boolean: Boolean<E>) -> LinearCombination<<E as Environment>::BaseField>
fn from(boolean: Boolean<E>) -> LinearCombination<<E as Environment>::BaseField>
§impl<E> FromBits for Boolean<E>where
E: Environment,
impl<E> FromBits for Boolean<E>where E: Environment,
§impl<E> FromStr for Boolean<E>where
E: Environment,
impl<E> FromStr for Boolean<E>where E: Environment,
§impl<E> Inject for Boolean<E>where
E: Environment,
impl<E> Inject for Boolean<E>where E: Environment,
§fn new(mode: Mode, value: <Boolean<E> as Inject>::Primitive) -> Boolean<E>
fn new(mode: Mode, value: <Boolean<E> as Inject>::Primitive) -> Boolean<E>
Initializes a new instance of a boolean from a primitive boolean value.
§fn constant(value: <Boolean<E> as Inject>::Primitive) -> Boolean<E>
fn constant(value: <Boolean<E> as Inject>::Primitive) -> Boolean<E>
Initializes a constant boolean circuit from a primitive boolean value.
type Primitive = bool
§impl<E> Nand<Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> Nand<Boolean<E>> for Boolean<E>where E: Environment,
§impl<E> Nor<Boolean<E>> for Boolean<E>where
E: Environment,
impl<E> Nor<Boolean<E>> for Boolean<E>where E: Environment,
§impl<E> Not for &Boolean<E>where
E: Environment,
impl<E> Not for &Boolean<E>where E: Environment,
§impl<E> Not for Boolean<E>where
E: Environment,
impl<E> Not for Boolean<E>where E: Environment,
§impl<E> OutputMode<dyn Nor<Boolean<E>, Output = Boolean<E>>> for Boolean<E>where
E: Environment,
impl<E> OutputMode<dyn Nor<Boolean<E>, Output = Boolean<E>>> for Boolean<E>where E: Environment,
type Case = (CircuitType<Boolean<E>>, CircuitType<Boolean<E>>)
§fn output_mode(
case: &<Boolean<E> as OutputMode<dyn Nor<Boolean<E>, Output = Boolean<E>>>>::Case
) -> Mode
fn output_mode( case: &<Boolean<E> as OutputMode<dyn Nor<Boolean<E>, Output = Boolean<E>>>>::Case ) -> Mode
§impl<E> OutputMode<dyn Not<Output = Boolean<E>>> for Boolean<E>where
E: Environment,
impl<E> OutputMode<dyn Not<Output = Boolean<E>>> for Boolean<E>where E: Environment,
§impl<E> Parser for Boolean<E>where
E: Environment,
impl<E> Parser for Boolean<E>where E: Environment,
§impl<E> Subtractor for Boolean<E>where
E: Environment,
impl<E> Subtractor for Boolean<E>where E: Environment,
§fn subtractor(
&self,
other: &Boolean<E>,
borrow: &Boolean<E>
) -> (<Boolean<E> as Subtractor>::Difference, <Boolean<E> as Subtractor>::Borrow)
fn subtractor( &self, other: &Boolean<E>, borrow: &Boolean<E> ) -> (<Boolean<E> as Subtractor>::Difference, <Boolean<E> as Subtractor>::Borrow)
Returns the difference of self
and other
as a difference bit and borrow bit.