Trait CoreConstructible

Source
pub trait CoreConstructible: Sized {
Show 22 methods // Required methods fn iden(inference_context: &Context) -> Self; fn unit(inference_context: &Context) -> Self; fn injl(child: &Self) -> Self; fn injr(child: &Self) -> Self; fn take(child: &Self) -> Self; fn drop_(child: &Self) -> Self; fn comp(left: &Self, right: &Self) -> Result<Self, Error>; fn case(left: &Self, right: &Self) -> Result<Self, Error>; fn assertl(left: &Self, right: Cmr) -> Result<Self, Error>; fn assertr(left: Cmr, right: &Self) -> Result<Self, Error>; fn pair(left: &Self, right: &Self) -> Result<Self, Error>; fn fail(inference_context: &Context, entropy: FailEntropy) -> Self; fn const_word(inference_context: &Context, word: Word) -> Self; fn inference_context(&self) -> &Context; // Provided methods fn scribe(ctx: &Context, value: &Value) -> Self { ... } fn bit_false(inference_context: &Context) -> Self { ... } fn bit_true(inference_context: &Context) -> Self { ... } fn cond(left: &Self, right: &Self) -> Result<Self, Error> { ... } fn assert(child: &Self, hash: Cmr) -> Result<Self, Error> { ... } fn not(child: &Self) -> Result<Self, Error> { ... } fn and(left: &Self, right: &Self) -> Result<Self, Error> { ... } fn or(left: &Self, right: &Self) -> Result<Self, Error> { ... }
}

Required Methods§

Source

fn iden(inference_context: &Context) -> Self

Source

fn unit(inference_context: &Context) -> 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, right: Cmr) -> Result<Self, Error>

Source

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

Source

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

Source

fn fail(inference_context: &Context, entropy: FailEntropy) -> Self

Source

fn const_word(inference_context: &Context, word: Word) -> Self

Source

fn inference_context(&self) -> &Context

Accessor for the type inference context used to create the object.

Provided Methods§

Source

fn scribe(ctx: &Context, value: &Value) -> Self

Create an expression that produces the given value.

The expression is minimized by using as many word jets as possible.

Source

fn bit_false(inference_context: &Context) -> Self

Create a DAG that takes any input and returns bit 0 as constant output.

Overall type: A → 2

Source

fn bit_true(inference_context: &Context) -> Self

Create a DAG that takes any input and returns bit 1 as constant output.

Overall type: A → 2

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

Overall type: 2 × A → B where left: A → B and right: A → B

Type inference will fail if children are not of the correct type.

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.

Overall type: A → 1 where child: A → 2

Type inference will fail if children are not of the correct type.

Source

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

Create a DAG that computes Boolean NOT of the child.

Overall type: A → 2 where child: A → 2

Type inference will fail if children are not of the correct type.

Source

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

Create a DAG that computes Boolean AND of the left and right child.

Overall type: A → 2 where left: A → 2 and right: A → 2

Type inference will fail if children are not of the correct type.

Source

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

Create a DAG that computes Boolean OR of the left and right.

Overall type: A → 2 where left: A → 2 and right: A → 2

Type inference will fail if children are not of the correct type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<N> CoreConstructible for Arc<Node<N>>

Source§

fn iden(inference_context: &Context) -> Self

Source§

fn unit(inference_context: &Context) -> 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, r_cmr: Cmr) -> Result<Self, Error>

Source§

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

Source§

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

Source§

fn fail(inference_context: &Context, entropy: FailEntropy) -> Self

Source§

fn const_word(inference_context: &Context, word: Word) -> Self

Source§

fn inference_context(&self) -> &Context

Implementors§