ark_r1cs_std::boolean

Enum Boolean

Source
pub enum Boolean<F: Field> {
    Var(AllocatedBool<F>),
    Constant(bool),
}
Expand description

Represents a boolean value in the constraint system which is guaranteed to be either zero or one.

Variants§

§

Var(AllocatedBool<F>)

§

Constant(bool)

Implementations§

Source§

impl<F: Field> Boolean<F>

Source

pub fn nand(&self, other: &Self) -> Result<Self, SynthesisError>

Outputs !(self & other).

Source§

impl<F: PrimeField> Boolean<F>

Source

pub fn kary_and(bits: &[Self]) -> Result<Self, SynthesisError>

Outputs bits[0] & bits[1] & ... & bits.last().unwrap().

// We'll use the BLS12-381 scalar field for our constraints.
use ark_test_curves::bls12_381::Fr;
use ark_relations::r1cs::*;
use ark_r1cs_std::prelude::*;

let cs = ConstraintSystem::<Fr>::new_ref();

let a = Boolean::new_witness(cs.clone(), || Ok(true))?;
let b = Boolean::new_witness(cs.clone(), || Ok(false))?;
let c = Boolean::new_witness(cs.clone(), || Ok(true))?;

Boolean::kary_and(&[a.clone(), b.clone(), c.clone()])?.enforce_equal(&Boolean::FALSE)?;
Boolean::kary_and(&[a.clone(), c.clone()])?.enforce_equal(&Boolean::TRUE)?;

assert!(cs.is_satisfied().unwrap());
Source

pub fn kary_nand(bits: &[Self]) -> Result<Self, SynthesisError>

Outputs !(bits[0] & bits[1] & ... & bits.last().unwrap()).

// We'll use the BLS12-381 scalar field for our constraints.
use ark_test_curves::bls12_381::Fr;
use ark_relations::r1cs::*;
use ark_r1cs_std::prelude::*;

let cs = ConstraintSystem::<Fr>::new_ref();

let a = Boolean::new_witness(cs.clone(), || Ok(true))?;
let b = Boolean::new_witness(cs.clone(), || Ok(false))?;
let c = Boolean::new_witness(cs.clone(), || Ok(true))?;

Boolean::kary_nand(&[a.clone(), b.clone(), c.clone()])?.enforce_equal(&Boolean::TRUE)?;
Boolean::kary_nand(&[a.clone(), c.clone()])?.enforce_equal(&Boolean::FALSE)?;
Boolean::kary_nand(&[b.clone(), c.clone()])?.enforce_equal(&Boolean::TRUE)?;

assert!(cs.is_satisfied().unwrap());
Source

pub fn enforce_kary_nand(bits: &[Self]) -> Result<(), SynthesisError>

Enforces that !(bits[0] & bits[1] & ... ) == Boolean::TRUE.

Informally, this means that at least one element in bits must be false.

Source§

impl<F: PrimeField> Boolean<F>

Source

pub fn enforce_in_field_le(bits: &[Self]) -> Result<(), SynthesisError>

Enforces that bits, when interpreted as a integer, is less than F::characteristic(), That is, interpret bits as a little-endian integer, and enforce that this integer is “in the field Z_p”, where p = F::characteristic() .

Source

pub fn enforce_smaller_or_equal_than_le( bits: &[Self], element: impl AsRef<[u64]>, ) -> Result<Vec<Self>, SynthesisError>

Enforces that bits is less than or equal to element, when both are interpreted as (little-endian) integers.

Source§

impl<F: Field> Boolean<F>

Source§

impl<F: PrimeField> Boolean<F>

Source

pub fn kary_or(bits: &[Self]) -> Result<Self, SynthesisError>

Outputs bits[0] | bits[1] | ... | bits.last().unwrap().

// We'll use the BLS12-381 scalar field for our constraints.
use ark_test_curves::bls12_381::Fr;
use ark_relations::r1cs::*;
use ark_r1cs_std::prelude::*;

let cs = ConstraintSystem::<Fr>::new_ref();

let a = Boolean::new_witness(cs.clone(), || Ok(true))?;
let b = Boolean::new_witness(cs.clone(), || Ok(false))?;
let c = Boolean::new_witness(cs.clone(), || Ok(false))?;

Boolean::kary_or(&[a.clone(), b.clone(), c.clone()])?.enforce_equal(&Boolean::TRUE)?;
Boolean::kary_or(&[a.clone(), c.clone()])?.enforce_equal(&Boolean::TRUE)?;
Boolean::kary_or(&[b.clone(), c.clone()])?.enforce_equal(&Boolean::FALSE)?;

assert!(cs.is_satisfied().unwrap());
Source§

impl<F: PrimeField> Boolean<F>

Source

pub fn select<T: CondSelectGadget<F>>( &self, first: &T, second: &T, ) -> Result<T, SynthesisError>

Conditionally selects one of first and second based on the value of self:

If self.is_eq(&Boolean::TRUE), this outputs first; else, it outputs second.

// We'll use the BLS12-381 scalar field for our constraints.
use ark_test_curves::bls12_381::Fr;
use ark_relations::r1cs::*;
use ark_r1cs_std::prelude::*;

let cs = ConstraintSystem::<Fr>::new_ref();

let a = Boolean::new_witness(cs.clone(), || Ok(true))?;
let b = Boolean::new_witness(cs.clone(), || Ok(false))?;

let cond = Boolean::new_witness(cs.clone(), || Ok(true))?;

cond.select(&a, &b)?.enforce_equal(&Boolean::TRUE)?;
cond.select(&b, &a)?.enforce_equal(&Boolean::FALSE)?;

assert!(cs.is_satisfied().unwrap());
Source§

impl<F: Field> Boolean<F>

Source

pub const TRUE: Self = _

The constant true.

Source

pub const FALSE: Self = _

The constant false.

Source

pub fn constant_vec_from_bytes(values: &[u8]) -> Vec<Self>

Constructs a Boolean vector from a slice of constant u8. The u8s are decomposed in little-endian manner.

This does not create any new variables or constraints.

// We'll use the BLS12-381 scalar field for our constraints.
use ark_test_curves::bls12_381::Fr;
use ark_relations::r1cs::*;
use ark_r1cs_std::prelude::*;

let cs = ConstraintSystem::<Fr>::new_ref();
let t = Boolean::<Fr>::TRUE;
let f = Boolean::<Fr>::FALSE;

let bits = vec![f, t];
let generated_bits = Boolean::constant_vec_from_bytes(&[2]);
bits[..2].enforce_equal(&generated_bits[..2])?;
assert!(cs.is_satisfied().unwrap());
Source

pub fn constant(b: bool) -> Self

Constructs a constant Boolean with value b.

This does not create any new variables or constraints.

// We'll use the BLS12-381 scalar field for our constraints.
use ark_test_curves::bls12_381::Fr;
use ark_r1cs_std::prelude::*;

let true_var = Boolean::<Fr>::TRUE;
let false_var = Boolean::<Fr>::FALSE;

true_var.enforce_equal(&Boolean::TRUE)?;
false_var.enforce_equal(&Boolean::constant(false))?;
Source

pub fn lc(&self) -> LinearCombination<F>

Constructs a LinearCombination from Self’s variables according to the following map.

  • Boolean::TRUE => lc!() + Variable::One
  • Boolean::FALSE => lc!()
  • Boolean::Var(v) => lc!() + v.variable()
Source

pub fn le_bits_to_fp(bits: &[Self]) -> Result<FpVar<F>, SynthesisError>
where F: PrimeField,

Convert a little-endian bitwise representation of a field element to FpVar<F>

Wraps around if the bit representation is larger than the field modulus.

Trait Implementations§

Source§

impl<F: Field> AllocVar<bool, F> for Boolean<F>

Source§

fn new_variable<T: Borrow<bool>>( cs: impl Into<Namespace<F>>, f: impl FnOnce() -> Result<T, SynthesisError>, mode: AllocationMode, ) -> Result<Self, SynthesisError>

Allocates a new variable of type Self in the ConstraintSystem cs. The mode of allocation is decided by mode.
Source§

fn new_constant( cs: impl Into<Namespace<F>>, t: impl Borrow<V>, ) -> Result<Self, SynthesisError>

Allocates a new constant of type Self in the ConstraintSystem cs. Read more
Source§

fn new_input<T: Borrow<V>>( cs: impl Into<Namespace<F>>, f: impl FnOnce() -> Result<T, SynthesisError>, ) -> Result<Self, SynthesisError>

Allocates a new public input of type Self in the ConstraintSystem cs.
Source§

fn new_witness<T: Borrow<V>>( cs: impl Into<Namespace<F>>, f: impl FnOnce() -> Result<T, SynthesisError>, ) -> Result<Self, SynthesisError>

Allocates a new private witness of type Self in the ConstraintSystem cs.
Source§

fn new_variable_with_inferred_mode<T: Borrow<V>>( cs: impl Into<Namespace<F>>, f: impl FnOnce() -> Result<T, SynthesisError>, ) -> Result<Self, SynthesisError>

Allocates a new constant or private witness of type Self in the ConstraintSystem cs with the allocation mode inferred from cs. A constant is allocated if cs is None, and a private witness is allocated otherwise. Read more
Source§

impl<'a, F: Field> BitAnd<&'a Boolean<F>> for Boolean<F>

Source§

type Output = Boolean<F>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: &Self) -> Self::Output

Performs the & operation. Read more
Source§

impl<'a, F: Field> BitAnd<Boolean<F>> for &'a Boolean<F>

Source§

type Output = Boolean<F>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: Boolean<F>) -> Self::Output

Performs the & operation. Read more
Source§

impl<'a, F: Field> BitAnd for &'a Boolean<F>

Source§

fn bitand(self, other: Self) -> Self::Output

Outputs self & other.

If at least one of self and other are constants, then this method does not create any constraints or variables.

// We'll use the BLS12-381 scalar field for our constraints.
use ark_test_curves::bls12_381::Fr;
use ark_relations::r1cs::*;
use ark_r1cs_std::prelude::*;

let cs = ConstraintSystem::<Fr>::new_ref();

let a = Boolean::new_witness(cs.clone(), || Ok(true))?;
let b = Boolean::new_witness(cs.clone(), || Ok(false))?;

(&a & &a).enforce_equal(&Boolean::TRUE)?;

(&a & &b).enforce_equal(&Boolean::FALSE)?;
(&b & &a).enforce_equal(&Boolean::FALSE)?;
(&b & &b).enforce_equal(&Boolean::FALSE)?;

assert!(cs.is_satisfied().unwrap());
Source§

type Output = Boolean<F>

The resulting type after applying the & operator.
Source§

impl<F: Field> BitAnd for Boolean<F>

Source§

type Output = Boolean<F>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl<'a, F: Field> BitAndAssign<&'a Boolean<F>> for Boolean<F>

Source§

fn bitand_assign(&mut self, other: &'a Self)

Sets self = self & other.

Source§

impl<F: Field> BitAndAssign for Boolean<F>

Source§

fn bitand_assign(&mut self, other: Self)

Sets self = self & other.

Source§

impl<'a, F: PrimeField> BitOr<&'a Boolean<F>> for Boolean<F>

Source§

type Output = Boolean<F>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: &Self) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a, F: PrimeField> BitOr<Boolean<F>> for &'a Boolean<F>

Source§

type Output = Boolean<F>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Boolean<F>) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a, F: PrimeField> BitOr for &'a Boolean<F>

Source§

fn bitor(self, other: Self) -> Self::Output

Outputs self | other.

If at least one of self and other are constants, then this method does not create any constraints or variables.

// We'll use the BLS12-381 scalar field for our constraints.
use ark_test_curves::bls12_381::Fr;
use ark_relations::r1cs::*;
use ark_r1cs_std::prelude::*;

let cs = ConstraintSystem::<Fr>::new_ref();

let a = Boolean::new_witness(cs.clone(), || Ok(true))?;
let b = Boolean::new_witness(cs.clone(), || Ok(false))?;

(&a | &b).enforce_equal(&Boolean::TRUE)?;
(&b | &a).enforce_equal(&Boolean::TRUE)?;

(&a | &a).enforce_equal(&Boolean::TRUE)?;
(&b | &b).enforce_equal(&Boolean::FALSE)?;

assert!(cs.is_satisfied().unwrap());
Source§

type Output = Boolean<F>

The resulting type after applying the | operator.
Source§

impl<F: PrimeField> BitOr for Boolean<F>

Source§

type Output = Boolean<F>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a, F: PrimeField> BitOrAssign<&'a Boolean<F>> for Boolean<F>

Source§

fn bitor_assign(&mut self, other: &'a Self)

Sets self = self | other.

Source§

impl<F: PrimeField> BitOrAssign for Boolean<F>

Source§

fn bitor_assign(&mut self, other: Self)

Sets self = self | other.

Source§

impl<'a, F: Field> BitXor<&'a Boolean<F>> for Boolean<F>

Source§

type Output = Boolean<F>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: &Self) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<'a, F: Field> BitXor<Boolean<F>> for &'a Boolean<F>

Source§

type Output = Boolean<F>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: Boolean<F>) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<'a, F: Field> BitXor for &'a Boolean<F>

Source§

fn bitxor(self, other: Self) -> Self::Output

Outputs self ^ other.

If at least one of self and other are constants, then this method does not create any constraints or variables.

// We'll use the BLS12-381 scalar field for our constraints.
use ark_test_curves::bls12_381::Fr;
use ark_relations::r1cs::*;
use ark_r1cs_std::prelude::*;

let cs = ConstraintSystem::<Fr>::new_ref();

let a = Boolean::new_witness(cs.clone(), || Ok(true))?;
let b = Boolean::new_witness(cs.clone(), || Ok(false))?;

(&a ^ &b).enforce_equal(&Boolean::TRUE)?;
(&b ^ &a).enforce_equal(&Boolean::TRUE)?;

(&a ^ &a).enforce_equal(&Boolean::FALSE)?;
(&b ^ &b).enforce_equal(&Boolean::FALSE)?;

assert!(cs.is_satisfied().unwrap());
Source§

type Output = Boolean<F>

The resulting type after applying the ^ operator.
Source§

impl<F: Field> BitXor for Boolean<F>

Source§

type Output = Boolean<F>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: Self) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<'a, F: Field> BitXorAssign<&'a Boolean<F>> for Boolean<F>

Source§

fn bitxor_assign(&mut self, other: &'a Self)

Sets self = self ^ other.

Source§

impl<F: Field> BitXorAssign for Boolean<F>

Source§

fn bitxor_assign(&mut self, other: Self)

Sets self = self ^ other.

Source§

impl<F: Clone + Field> Clone for Boolean<F>

Source§

fn clone(&self) -> Boolean<F>

Returns a copy 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<F: PrimeField> CmpGadget<F> for Boolean<F>

Source§

fn is_ge(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>

Source§

fn is_gt(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>

Source§

fn is_lt(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>

Source§

fn is_le(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>

Source§

impl<F: PrimeField> CondSelectGadget<F> for Boolean<F>

Source§

fn conditionally_select( cond: &Boolean<F>, true_val: &Self, false_val: &Self, ) -> Result<Self, SynthesisError>

If cond == &Boolean::TRUE, then this returns true_value; else, returns false_value. Read more
Source§

fn conditionally_select_power_of_two_vector( position: &[Boolean<ConstraintF>], values: &[Self], ) -> Result<Self, SynthesisError>

Returns an element of values whose index in represented by position. position is an array of boolean that represents an unsigned integer in big endian order. Read more
Source§

impl<F: Debug + Field> Debug for Boolean<F>

Source§

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

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

impl<F: Field> EqGadget<F> for Boolean<F>

Source§

fn is_eq(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>

Output a Boolean value representing whether self.value() == other.value().
Source§

fn conditional_enforce_equal( &self, other: &Self, condition: &Boolean<F>, ) -> Result<(), SynthesisError>

If should_enforce == true, enforce that self and other are equal; else, enforce a vacuously true statement. Read more
Source§

fn conditional_enforce_not_equal( &self, other: &Self, should_enforce: &Boolean<F>, ) -> Result<(), SynthesisError>

If should_enforce == true, enforce that self and other are not equal; else, enforce a vacuously true statement. Read more
Source§

fn is_neq(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>

Output a Boolean value representing whether self.value() != other.value(). Read more
Source§

fn enforce_equal(&self, other: &Self) -> Result<(), SynthesisError>

Enforce that self and other are equal. Read more
Source§

fn enforce_not_equal(&self, other: &Self) -> Result<(), SynthesisError>

Enforce that self and other are not equal. Read more
Source§

impl<F: Field> From<AllocatedBool<F>> for Boolean<F>

Source§

fn from(b: AllocatedBool<F>) -> Self

Converts to this type from the input type.
Source§

impl<BF, P> From<Boolean<<P as CubicExtConfig>::BasePrimeField>> for CubicExtVar<BF, P>
where BF: FieldVar<P::BaseField, P::BasePrimeField>, for<'a> &'a BF: FieldOpsBounds<'a, P::BaseField, BF>, P: CubicExtVarConfig<BF>,

Source§

fn from(other: Boolean<P::BasePrimeField>) -> Self

Converts to this type from the input type.
Source§

impl<BF, P> From<Boolean<<P as QuadExtConfig>::BasePrimeField>> for QuadExtVar<BF, P>
where BF: FieldVar<P::BaseField, P::BasePrimeField>, for<'a> &'a BF: FieldOpsBounds<'a, P::BaseField, BF>, P: QuadExtVarConfig<BF>,

Source§

fn from(other: Boolean<P::BasePrimeField>) -> Self

Converts to this type from the input type.
Source§

impl<TargetF: PrimeField, BaseF: PrimeField> From<Boolean<BaseF>> for EmulatedFpVar<TargetF, BaseF>

Source§

fn from(other: Boolean<BaseF>) -> Self

Converts to this type from the input type.
Source§

impl<F: PrimeField> From<Boolean<F>> for FpVar<F>

Source§

fn from(other: Boolean<F>) -> Self

Converts to this type from the input type.
Source§

impl<'a, F: Field> Not for &'a Boolean<F>

Source§

fn not(self) -> Self::Output

Negates self.

This does not create any new variables or constraints.

// We'll use the BLS12-381 scalar field for our constraints.
use ark_test_curves::bls12_381::Fr;
use ark_relations::r1cs::*;
use ark_r1cs_std::prelude::*;

let cs = ConstraintSystem::<Fr>::new_ref();

let a = Boolean::new_witness(cs.clone(), || Ok(true))?;
let b = Boolean::new_witness(cs.clone(), || Ok(false))?;

(!&a).enforce_equal(&b)?;
(!&b).enforce_equal(&a)?;

(!&a).enforce_equal(&Boolean::FALSE)?;
(!&b).enforce_equal(&Boolean::TRUE)?;

assert!(cs.is_satisfied().unwrap());
Source§

type Output = Boolean<F>

The resulting type after applying the ! operator.
Source§

impl<'a, F: Field> Not for &'a mut Boolean<F>

Source§

type Output = Boolean<F>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<F: Field> Not for Boolean<F>

Source§

type Output = Boolean<F>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<F: PartialEq + Field> PartialEq for Boolean<F>

Source§

fn eq(&self, other: &Boolean<F>) -> 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<F: Field> ToBitsGadget<F> for Boolean<F>

Source§

fn to_bits_le(&self) -> Result<Vec<Boolean<F>>, SynthesisError>

Outputs the canonical little-endian bit-wise representation of self. Read more
Source§

fn to_non_unique_bits_le(&self) -> Result<Vec<Boolean<F>>, SynthesisError>

Outputs a possibly non-unique little-endian bit-wise representation of self. Read more
Source§

fn to_bits_be(&self) -> Result<Vec<Boolean<F>>, SynthesisError>

Outputs the canonical big-endian bit-wise representation of self.
Source§

fn to_non_unique_bits_be(&self) -> Result<Vec<Boolean<F>>, SynthesisError>

Outputs a possibly non-unique big-endian bit-wise representation of self.
Source§

impl<F: Field> ToBytesGadget<F> for Boolean<F>

Source§

fn to_bytes_le(&self) -> Result<Vec<UInt8<F>>, SynthesisError>

Outputs 1u8 if self is true, and 0u8 otherwise.

Source§

fn to_non_unique_bytes_le(&self) -> Result<Vec<UInt8<F>>, SynthesisError>

Outputs a possibly non-unique byte decomposition of self. Read more
Source§

impl<F: PrimeField> ToConstraintFieldGadget<F> for Boolean<F>

Source§

fn to_constraint_field(&self) -> Result<Vec<FpVar<F>>, SynthesisError>

Converts self to FpVar<ConstraintF> variables.
Source§

impl<F: Eq + Field> Eq for Boolean<F>

Source§

impl<F: Field> StructuralPartialEq for Boolean<F>

Auto Trait Implementations§

§

impl<F> Freeze for Boolean<F>

§

impl<F> !RefUnwindSafe for Boolean<F>

§

impl<F> !Send for Boolean<F>

§

impl<F> !Sync for Boolean<F>

§

impl<F> Unpin for Boolean<F>

§

impl<F> !UnwindSafe for Boolean<F>

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, dst: *mut T)

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

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more