snarkvm_console_types_scalar

Struct Boolean

Source
pub struct Boolean<E>
where E: Environment,
{ /* private fields */ }

Implementations§

Source§

impl<E> Boolean<E>
where E: Environment,

Source

pub const fn new(boolean: bool) -> Boolean<E>

Initializes a new boolean.

Source

pub const fn zero() -> Boolean<E>

👎Deprecated since 0.1.0: This is used for testing purposes

Initializes a false boolean.

Trait Implementations§

Source§

impl<E> BitAnd<&Boolean<E>> for Boolean<E>
where E: Environment,

Source§

fn bitand( self, other: &Boolean<E>, ) -> <Boolean<E> as BitAnd<&Boolean<E>>>::Output

Returns the bitwise AND of self and other.

Source§

type Output = Boolean<E>

The resulting type after applying the & operator.
Source§

impl<E> BitAnd for Boolean<E>
where E: Environment,

Source§

fn bitand(self, other: Boolean<E>) -> <Boolean<E> as BitAnd>::Output

Returns the bitwise AND`` of selfandother`.

Source§

type Output = Boolean<E>

The resulting type after applying the & operator.
Source§

impl<E> BitAndAssign for Boolean<E>
where E: Environment,

Source§

fn bitand_assign(&mut self, other: Boolean<E>)

Sets self as the bitwise AND of self and other.

Source§

impl<E> BitOr<&Boolean<E>> for Boolean<E>
where E: Environment,

Source§

fn bitor(self, other: &Boolean<E>) -> <Boolean<E> as BitOr<&Boolean<E>>>::Output

Returns the bitwise OR of self and other.

Source§

type Output = Boolean<E>

The resulting type after applying the | operator.
Source§

impl<E> BitOr for Boolean<E>
where E: Environment,

Source§

fn bitor(self, other: Boolean<E>) -> <Boolean<E> as BitOr>::Output

Returns the bitwise OR of self and other.

Source§

type Output = Boolean<E>

The resulting type after applying the | operator.
Source§

impl<E> BitOrAssign for Boolean<E>
where E: Environment,

Source§

fn bitor_assign(&mut self, other: Boolean<E>)

Sets self as the bitwise OR of self and other.

Source§

impl<E> BitXor<&Boolean<E>> for Boolean<E>
where E: Environment,

Source§

fn bitxor( self, other: &Boolean<E>, ) -> <Boolean<E> as BitXor<&Boolean<E>>>::Output

Returns the bitwise XOR of self and other.

Source§

type Output = Boolean<E>

The resulting type after applying the ^ operator.
Source§

impl<E> BitXor for Boolean<E>
where E: Environment,

Source§

fn bitxor(self, other: Boolean<E>) -> <Boolean<E> as BitXor>::Output

Returns the bitwise XOR of self and other.

Source§

type Output = Boolean<E>

The resulting type after applying the ^ operator.
Source§

impl<E> BitXorAssign for Boolean<E>
where E: Environment,

Source§

fn bitxor_assign(&mut self, other: Boolean<E>)

Sets self as the bitwise XOR of self and other.

Source§

impl<E> Clone for Boolean<E>
where E: Clone + Environment,

Source§

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

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<E> Debug for Boolean<E>
where E: Environment,

Source§

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

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

impl<E> Deref for Boolean<E>
where E: Environment,

Source§

type Target = bool

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<Boolean<E> as Deref>::Target

Dereferences the value.
Source§

impl<'de, E> Deserialize<'de> for Boolean<E>
where E: Environment,

Source§

fn deserialize<D>( deserializer: D, ) -> Result<Boolean<E>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserializes the boolean from a string or bytes.

Source§

impl<E> Display for Boolean<E>
where E: Environment,

Source§

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

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

impl<E> Distribution<Boolean<E>> for Standard
where E: Environment,

Source§

fn sample<R>(&self, rng: &mut R) -> Boolean<E>
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

impl<E> Equal for Boolean<E>
where E: Environment,

Source§

fn is_equal(&self, other: &Boolean<E>) -> <Boolean<E> as Equal>::Output

Returns true if self and other are equal.

Source§

fn is_not_equal(&self, other: &Boolean<E>) -> <Boolean<E> as Equal>::Output

Returns true if self and other are not equal.

Source§

type Output = Boolean<E>

Source§

impl<E> FromBits for Boolean<E>
where E: Environment,

Source§

fn from_bits_le(bits_le: &[bool]) -> Result<Boolean<E>, Error>

Initializes a new boolean by extracting the first bit from a list of length 1.

Source§

fn from_bits_be(bits_be: &[bool]) -> Result<Boolean<E>, Error>

Initializes a new boolean by extracting the first bit from a list of length 1.

Source§

impl<E> FromBytes for Boolean<E>
where E: Environment,

Source§

fn read_le<R>(reader: R) -> Result<Boolean<E>, Error>
where R: Read,

Reads the boolean from a buffer.

Source§

fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized,

Returns Self from a byte array in little-endian order.
Source§

impl<E> FromStr for Boolean<E>
where E: Environment,

Source§

fn from_str(string: &str) -> Result<Boolean<E>, Error>

Parses a string into a boolean.

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl<E> Hash for Boolean<E>
where E: Hash + Environment,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<E> Nand for Boolean<E>
where E: Environment,

Source§

fn nand(&self, other: &Boolean<E>) -> <Boolean<E> as Nand>::Output

Returns the bitwise NAND of self and other.

Source§

type Output = Boolean<E>

Source§

impl<E> Nor for Boolean<E>
where E: Environment,

Source§

fn nor(&self, other: &Boolean<E>) -> <Boolean<E> as Nor>::Output

Returns the bitwise NOR of self and other.

Source§

type Output = Boolean<E>

Source§

impl<E> Not for Boolean<E>
where E: Environment,

Source§

fn not(self) -> <Boolean<E> as Not>::Output

Returns the negation of self.

Source§

type Output = Boolean<E>

The resulting type after applying the ! operator.
Source§

impl<E> Parser for Boolean<E>
where E: Environment,

Source§

fn parse(string: &str) -> Result<(&str, Boolean<E>), Err<VerboseError<&str>>>

Parses a string into a boolean.

Source§

impl<E> PartialEq<Boolean<E>> for bool
where E: Environment,

Source§

fn eq(&self, other: &Boolean<E>) -> 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<E> PartialEq for Boolean<E>

Source§

fn eq(&self, other: &Boolean<E>) -> 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<E> Serialize for Boolean<E>
where E: Environment,

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serializes the boolean into a string or as bytes.

Source§

impl<E> SizeInBits for Boolean<E>
where E: Environment,

Source§

fn size_in_bits() -> usize

Returns the field size in bits.

Source§

impl<E> SizeInBytes for Boolean<E>
where E: Environment,

Source§

fn size_in_bytes() -> usize

Returns the boolean size in bytes.

Source§

impl<E> SizeInDataBits for Boolean<E>
where E: Environment,

Source§

fn size_in_data_bits() -> usize

Returns the field capacity for data bits.

Source§

impl<E> Ternary for Boolean<E>
where E: Environment,

Source§

fn ternary( condition: &<Boolean<E> as Ternary>::Boolean, first: &Boolean<E>, second: &Boolean<E>, ) -> <Boolean<E> as Ternary>::Output

Returns first if condition is true, otherwise returns second.

Source§

type Boolean = Boolean<E>

Source§

type Output = Boolean<E>

Source§

impl<E> ToBits for Boolean<E>
where E: Environment,

Source§

fn write_bits_le(&self, vec: &mut Vec<bool>)

Outputs self in a vector.

Source§

fn write_bits_be(&self, vec: &mut Vec<bool>)

Outputs self in a vector.

Source§

fn to_bits_le(&self) -> Vec<bool>

Returns self as a boolean array in little-endian order.
Source§

fn to_bits_be(&self) -> Vec<bool>

Returns self as a boolean array in big-endian order.
Source§

fn num_bits() -> Option<usize>

An optional indication of how many bits an object can be represented with.
Source§

impl<E> ToBytes for Boolean<E>
where E: Environment,

Source§

fn write_le<W>(&self, writer: W) -> Result<(), Error>
where W: Write,

Writes the boolean to a buffer.

Source§

fn to_bytes_le(&self) -> Result<Vec<u8>, Error>
where Self: Sized,

Returns self as a byte array in little-endian order.
Source§

impl<E> TypeName for Boolean<E>
where E: Environment,

Source§

fn type_name() -> &'static str

Returns the type name as a string.

Source§

impl<E> BooleanTrait for Boolean<E>
where E: Environment,

Source§

impl<E> Copy for Boolean<E>
where E: Copy + Environment,

Source§

impl<E> Eq for Boolean<E>
where E: Eq + Environment,

Source§

impl<E> StructuralPartialEq for Boolean<E>
where E: Environment,

Auto Trait Implementations§

§

impl<E> Freeze for Boolean<E>

§

impl<E> RefUnwindSafe for Boolean<E>
where E: RefUnwindSafe,

§

impl<E> Send for Boolean<E>

§

impl<E> Sync for Boolean<E>

§

impl<E> Unpin for Boolean<E>
where E: Unpin,

§

impl<E> UnwindSafe for Boolean<E>
where E: UnwindSafe,

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 u8)

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

impl<'de, T> DeserializeExt<'de> for T

Source§

fn take_from_value<D>( value: &mut Value, field: &str, ) -> Result<T, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

Compare self to key and return true if they are equal.
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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> Uniform for T

Source§

fn rand<R>(rng: &mut R) -> T
where R: Rng + ?Sized,

Samples a random value from a uniform distribution.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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