Struct simplicity::types::arrow::Arrow

source ·
pub struct Arrow {
    pub source: Type,
    pub target: Type,
}
Expand description

A container for an expression’s source and target types, whether or not these types are complete.

Fields§

§source: Type

The source type

§target: Type

The target type

Implementations§

source§

impl Arrow

source

pub fn finalize(&self) -> Result<FinalArrow, Error>

Finalize the source and target types in the arrow

source

pub fn for_unit() -> Self

Create a unification arrow for a fresh unit combinator

source

pub fn for_iden() -> Self

Create a unification arrow for a fresh iden combinator

source

pub fn for_witness() -> Self

Create a unification arrow for a fresh witness combinator

source

pub fn for_fail() -> Self

Create a unification arrow for a fresh fail combinator

source

pub fn for_jet<J: Jet>(jet: J) -> Self

Create a unification arrow for a fresh jet combinator

source

pub fn for_const_word(word: &Value) -> Self

Create a unification arrow for a fresh const-word combinator

source

pub fn for_injl(child_arrow: &Arrow) -> Self

Create a unification arrow for a fresh injl combinator

source

pub fn for_injr(child_arrow: &Arrow) -> Self

Create a unification arrow for a fresh injr combinator

source

pub fn for_take(child_arrow: &Arrow) -> Self

Create a unification arrow for a fresh take combinator

source

pub fn for_drop(child_arrow: &Arrow) -> Self

Create a unification arrow for a fresh drop combinator

source

pub fn for_pair( lchild_arrow: &Arrow, rchild_arrow: &Arrow ) -> Result<Self, Error>

Create a unification arrow for a fresh pair combinator

source

pub fn for_comp( lchild_arrow: &Arrow, rchild_arrow: &Arrow ) -> Result<Self, Error>

Create a unification arrow for a fresh comp combinator

source

pub fn for_case( lchild_arrow: Option<&Arrow>, rchild_arrow: Option<&Arrow> ) -> Result<Self, Error>

Create a unification arrow for a fresh case combinator

Either child may be None, in which case the combinator is assumed to be an assertion, which for type-inference purposes means there are no bounds on the missing child.

If neither child is provided, this function will not raise an error; it is the responsibility of the caller to detect this case and error elsewhere.

source

pub fn for_disconnect( lchild_arrow: &Arrow, rchild_arrow: &Arrow ) -> Result<Self, Error>

Create a unification arrow for a fresh comp combinator

source

pub fn shallow_clone(&self) -> Self

Same as Self::clone but named to make it clearer that this is cheap

Trait Implementations§

source§

impl Clone for Arrow

source§

fn clone(&self) -> Arrow

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 CoreConstructible for Arrow

source§

fn iden() -> Self

source§

fn unit() -> Self

source§

fn injl(child: &Self) -> Self

source§

fn injr(child: &Self) -> Self

source§

fn take(child: &Self) -> Self

source§

fn drop_(child: &Self) -> Self

source§

fn comp(left: &Self, right: &Self) -> Result<Self, Error>

source§

fn case(left: &Self, right: &Self) -> Result<Self, Error>

source§

fn assertl(left: &Self, _: Cmr) -> Result<Self, Error>

source§

fn assertr(_: Cmr, right: &Self) -> Result<Self, Error>

source§

fn pair(left: &Self, right: &Self) -> Result<Self, Error>

source§

fn fail(_: FailEntropy) -> Self

source§

fn const_word(word: Arc<Value>) -> Self

source§

fn scribe(value: &Value) -> Self

Create a DAG that takes any input and returns value as constant output. Read more
source§

fn bit_false() -> Self

Create a DAG that takes any input and returns bit 0 as constant output. Read more
source§

fn bit_true() -> Self

Create a DAG that takes any input and returns bit 1 as constant output. Read more
source§

fn cond(left: &Self, right: &Self) -> Result<Self, Error>

Create a DAG that takes a bit and an input, such that the left child is evaluated on the input if the bit is 1 (if branch) and the right child is evaluated on the input otherwise (else branch). Read more
source§

fn assert(child: &Self, hash: Cmr) -> Result<Self, Error>

Create a DAG that asserts that its child returns true, and fails otherwise. The hash identifies the assertion and is returned upon failure. Read more
source§

fn not(child: &Self) -> Result<Self, Error>

Create a DAG that computes Boolean NOT of the child. Read more
source§

fn and(left: &Self, right: &Self) -> Result<Self, Error>

Create a DAG that computes Boolean AND of the left and right child. Read more
source§

fn or(left: &Self, right: &Self) -> Result<Self, Error>

Create a DAG that computes Boolean OR of the left and right. Read more
source§

impl Debug for Arrow

source§

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

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

impl DisconnectConstructible<Arrow> for Arrow

source§

fn disconnect(left: &Self, right: &Self) -> Result<Self, Error>

source§

impl DisconnectConstructible<NoDisconnect> for Arrow

source§

impl DisconnectConstructible<Option<&Arrow>> for Arrow

source§

fn disconnect(left: &Self, right: &Option<&Self>) -> Result<Self, Error>

source§

impl Display for Arrow

source§

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

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

impl<J: Jet> JetConstructible<J> for Arrow

source§

fn jet(jet: J) -> Self

source§

impl<W> WitnessConstructible<W> for Arrow

source§

fn witness(_: W) -> Self

Auto Trait Implementations§

§

impl RefUnwindSafe for Arrow

§

impl Send for Arrow

§

impl Sync for Arrow

§

impl Unpin for Arrow

§

impl UnwindSafe for Arrow

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<J, X, W, T> Constructible<J, X, W> for T

source§

fn from_inner(inner: Inner<&Self, J, &X, W>) -> Result<Self, Error>

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

§

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§

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>,

§

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>,

§

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.
§

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

§

fn vzip(self) -> V