Trait simplicity::jet::Jet
source · pub trait Jet: Copy + Eq + Ord + Hash + Debug + Display + FromStr + 'static {
type Environment;
type CJetEnvironment;
// Required methods
fn cmr(&self) -> Cmr;
fn source_ty(&self) -> TypeName;
fn target_ty(&self) -> TypeName;
fn encode<W: Write>(&self, w: &mut BitWriter<W>) -> Result<usize>;
fn decode<I: Iterator<Item = u8>>(
bits: &mut BitIter<I>
) -> Result<Self, Error>;
fn c_jet_env<'env>(
&self,
env: &'env Self::Environment
) -> &'env Self::CJetEnvironment;
fn c_jet_ptr(
&self
) -> &dyn Fn(&mut CFrameItem, CFrameItem, &Self::CJetEnvironment) -> bool;
fn cost(&self) -> Cost;
}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 Associated Types§
sourcetype Environment
type Environment
Environment for jet to read from
sourcetype CJetEnvironment
type CJetEnvironment
CJetEnvironment to interact with C FFI.
Required Methods§
sourcefn decode<I: Iterator<Item = u8>>(bits: &mut BitIter<I>) -> Result<Self, Error>
fn decode<I: Iterator<Item = u8>>(bits: &mut BitIter<I>) -> Result<Self, Error>
Decode a jet from bits.
sourcefn c_jet_env<'env>(
&self,
env: &'env Self::Environment
) -> &'env Self::CJetEnvironment
fn c_jet_env<'env>( &self, env: &'env Self::Environment ) -> &'env Self::CJetEnvironment
Obtains a C FFI compatible environment for the jet.
sourcefn c_jet_ptr(
&self
) -> &dyn Fn(&mut CFrameItem, CFrameItem, &Self::CJetEnvironment) -> bool
fn c_jet_ptr( &self ) -> &dyn Fn(&mut CFrameItem, CFrameItem, &Self::CJetEnvironment) -> bool
Obtain the FFI C pointer for the jet.
Object Safety§
This trait is not object safe.