Struct WitnessValues

Source
pub struct WitnessValues(/* private fields */);
Expand description

Map of witness values.

Implementations§

Source§

impl WitnessValues

Source

pub fn analyze(from: &ModuleProgram) -> Result<Self, RichError>

Source§

impl WitnessValues

Source

pub fn get(&self, name: &WitnessName) -> Option<&Value>

Get the value that is assigned to the given name.

Source

pub fn iter(&self) -> impl Iterator<Item = (&WitnessName, &Value)>

Create an iterator over all name-value pairs.

Source

pub fn shallow_clone(&self) -> Self

Make a cheap copy of the map.

Source§

impl WitnessValues

Source

pub fn is_consistent(&self, witness_types: &WitnessTypes) -> Result<(), Error>

Check if the witness values are consistent with the declared witness types.

  1. Values that occur in the program are type checked.
  2. Values that don’t occur in the program are skipped. The witness map may contain more values than necessary.

There may be witnesses that are referenced in the program that are not assigned a value in the witness map. These witnesses may lie on pruned branches that will not be part of the finalized Simplicity program. However, before the finalization, we cannot know which witnesses will be pruned and which won’t be pruned. This check skips unassigned witnesses.

Trait Implementations§

Source§

impl Clone for WitnessValues

Source§

fn clone(&self) -> WitnessValues

Returns a duplicate 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 Debug for WitnessValues

Source§

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

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

impl Default for WitnessValues

Source§

fn default() -> WitnessValues

Returns the “default value” for a type. Read more
Source§

impl Display for WitnessValues

Source§

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

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

impl From<HashMap<WitnessName, Value>> for WitnessValues

Source§

fn from(value: HashMap<WitnessName, Value>) -> Self

Converts to this type from the input type.
Source§

impl ParseFromStr for WitnessValues

Source§

fn parse_from_str(s: &str) -> Result<Self, RichError>

Parse a value from the string s.
Source§

impl PartialEq for WitnessValues

Source§

fn eq(&self, other: &WitnessValues) -> 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 Eq for WitnessValues

Source§

impl StructuralPartialEq for WitnessValues

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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> 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> 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