Skip to main content

Jet

Trait Jet 

Source
pub trait Jet:
    DynJet
    + Debug
    + Display
    + Send
    + Sync
    + 'static {
    // Required methods
    fn cmr(&self) -> Cmr;
    fn source_ty(&self) -> TypeName;
    fn target_ty(&self) -> TypeName;
    fn encode(&self, w: &mut BitWriter<&mut dyn Write>) -> Result<usize>;
    fn decode<I: Iterator<Item = u8>>(
        bits: &mut BitIter<I>,
    ) -> Result<Self, Error>
       where Self: Sized;
    fn cost(&self) -> Cost;
    fn parse(s: &str) -> Result<Self, Error>
       where Self: Sized;
}
Expand description

Family of jets that share an encoding scheme and execution environment.

Jets are single nodes that read an input, process it internally using foreign C code (black box), and produce an output. Jets may read values from their environment.

Jets are always leaves in a Simplicity DAG.

Required Methods§

Source

fn cmr(&self) -> Cmr

Return the CMR of the jet.

Source

fn source_ty(&self) -> TypeName

Return the source type of the jet.

Source

fn target_ty(&self) -> TypeName

Return the target type of the jet.

Source

fn encode(&self, w: &mut BitWriter<&mut dyn Write>) -> Result<usize>

Encode the jet to bits.

Source

fn decode<I: Iterator<Item = u8>>(bits: &mut BitIter<I>) -> Result<Self, Error>
where Self: Sized,

Decode a jet from bits.

Source

fn cost(&self) -> Cost

Return the cost of the jet.

Source

fn parse(s: &str) -> Result<Self, Error>
where Self: Sized,

Parse a jet from a string.

Trait Implementations§

Source§

impl Clone for Box<dyn Jet>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Hash for Box<dyn Jet>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Box<dyn Jet>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Box<dyn Jet>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 PartialOrd for Box<dyn Jet>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for Box<dyn Jet>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§