Struct EvalAwi

Source
pub struct EvalAwi { /* private fields */ }
Expand description

When created from a type implementing AsRef<dag::Bits>, it can later be used to evaluate its dynamic value.

This will keep the source tree alive in case of pruning.

§Custom Drop

Upon being dropped, this will remove special references being kept by the current Epoch.

Implementations§

Source§

impl EvalAwi

Source

pub fn from_bool(x: bool) -> Self

Source

pub fn from_u8(x: u8) -> Self

Source

pub fn from_i8(x: i8) -> Self

Source

pub fn from_u16(x: u16) -> Self

Source

pub fn from_i16(x: i16) -> Self

Source

pub fn from_u32(x: u32) -> Self

Source

pub fn from_i32(x: i32) -> Self

Source

pub fn from_u64(x: u64) -> Self

Source

pub fn from_i64(x: i64) -> Self

Source

pub fn from_u128(x: u128) -> Self

Source

pub fn from_i128(x: i128) -> Self

Source

pub fn from_usize(x: usize) -> Self

Source

pub fn from_isize(x: isize) -> Self

Source

pub fn eval_bool(&self) -> Result<bool, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn eval_u8(&self) -> Result<u8, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn eval_i8(&self) -> Result<i8, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn eval_u16(&self) -> Result<u16, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn eval_i16(&self) -> Result<i16, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn eval_u32(&self) -> Result<u32, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn eval_i32(&self) -> Result<i32, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn eval_u64(&self) -> Result<u64, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn eval_i64(&self) -> Result<i64, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn eval_u128(&self) -> Result<u128, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn eval_i128(&self) -> Result<i128, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn eval_usize(&self) -> Result<usize, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn eval_isize(&self) -> Result<isize, Error>

The same as EvalAwi::eval, except that it returns a primitive and returns an error if the bitwidth of the evaluation does not match the bitwidth of the primitive

Source

pub fn from_state(p_state: PState) -> Self

Used internally to create EvalAwis

§Panics

If an Epoch does not exist or the PState was pruned

Source

pub fn p_external(&self) -> PExternal

Source

pub fn nzbw(&self) -> NonZeroUsize

Source

pub fn bw(&self) -> usize

Source

pub fn try_clone(&self) -> Result<Self, Error>

Clones self, returning a perfectly equivalent Eval that will have the same eval effects. Returns an error if the active Epoch is not correct.

Source

pub fn from_bits(bits: &Bits) -> Self

Can panic if the state has been pruned

Source

pub fn eval(&self) -> Result<Awi, Error>

Evaluates the value that self would evaluate to given the current state of any LazyAwis. Depending on the conditions of internal LUTs, it may be possible to evaluate to a known value even if some inputs are opaque, but in general this will return an error that a bit could not be evaluated to a known value, if any upstream inputs are opaque.

Source

pub fn eval_is_all_unknown(&self) -> Result<bool, Error>

Like EvalAwi::eval, except it returns if the values are all unknowns

Source

pub fn set_debug_name<S: AsRef<str>>(&self, debug_name: S) -> Result<(), Error>

Sets a debug name for self that is used in debug reporting and rendering

Source

pub fn opaque(w: NonZeroUsize) -> Self

Source

pub fn zero(w: NonZeroUsize) -> Self

Source

pub fn umax(w: NonZeroUsize) -> Self

Source

pub fn imax(w: NonZeroUsize) -> Self

Source

pub fn imin(w: NonZeroUsize) -> Self

Source

pub fn uone(w: NonZeroUsize) -> Self

Trait Implementations§

Source§

impl Binary for EvalAwi

Source§

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

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

impl<const W: usize> Borrow<EvalAwi> for Out<W>

Source§

fn borrow(&self) -> &EvalAwi

Immutably borrows from an owned value. Read more
Source§

impl Debug for EvalAwi

Source§

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

Can only display some fields if the Epoch self was created in is active

Source§

impl Display for EvalAwi

Source§

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

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

impl Drop for EvalAwi

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<B: AsRef<Bits>> From<B> for EvalAwi

Source§

fn from(b: B) -> Self

Converts to this type from the input type.
Source§

impl<const W: usize> Into<EvalAwi> for Out<W>

Source§

fn into(self) -> EvalAwi

Converts this type into the (usually inferred) input type.
Source§

impl LowerHex for EvalAwi

Source§

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

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

impl Octal for EvalAwi

Source§

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

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

impl UpperHex for EvalAwi

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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> ToString for T
where T: Display + ?Sized,

Source§

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

Source§

fn vzip(self) -> V