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::Environment) -> &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::Environment) -> &Self::CJetEnvironment
fn c_jet_env(env: &Self::Environment) -> &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.
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.