Trait simplicity::node::CoreConstructible
source · pub trait CoreConstructible: Sized {
Show 21 methods
// Required methods
fn iden() -> Self;
fn unit() -> 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(entropy: FailEntropy) -> Self;
fn const_word(word: Arc<Value>) -> Self;
// Provided methods
fn scribe(value: &Value) -> Self { ... }
fn bit_false() -> Self { ... }
fn bit_true() -> 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§
fn iden() -> Self
fn unit() -> 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(entropy: FailEntropy) -> Self
fn const_word(word: Arc<Value>) -> Self
Provided Methods§
sourcefn scribe(value: &Value) -> Self
fn scribe(value: &Value) -> Self
Create a DAG that takes any input and returns value as constant output.
Overall type: A → B where value: B
sourcefn bit_false() -> Self
fn bit_false() -> Self
Create a DAG that takes any input and returns bit 0 as constant output.
Overall type: A → 2
sourcefn bit_true() -> Self
fn bit_true() -> Self
Create a DAG that takes any input and returns bit 1 as constant output.
Overall type: A → 2
sourcefn cond(left: &Self, right: &Self) -> Result<Self, Error>
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.
sourcefn assert(child: &Self, hash: Cmr) -> Result<Self, Error>
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.
sourcefn not(child: &Self) -> Result<Self, Error>
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.