pub struct CScriptRegistry { /* private fields */ }Expand description
Caches loaded libraries by path, so several block instances naming the same lib= file
share one dlopen’d image while each still gets its own CScriptInstance (own state
pointer) — see the module doc comment, “Multi-instance state.”
Implementations§
Source§impl CScriptRegistry
impl CScriptRegistry
pub fn new() -> Self
Sourcepub fn instantiate(
&mut self,
path: &Path,
) -> Result<CScriptInstance, CScriptError>
pub fn instantiate( &mut self, path: &Path, ) -> Result<CScriptInstance, CScriptError>
Loads path if not already cached, then creates and returns a fresh instance from it
(its own cscript_start() call, its own state) using the plain contract: requires
cscript_output (via CScriptInstance::call), for a block with xc_count == 0.
Sourcepub fn instantiate_xc(
&mut self,
path: &Path,
) -> Result<CScriptInstance, CScriptError>
pub fn instantiate_xc( &mut self, path: &Path, ) -> Result<CScriptInstance, CScriptError>
Loads path if not already cached, then creates and returns a fresh instance from it
using the continuous-state (xc) contract: requires cscript_derivative and
cscript_output_xc (via CScriptInstance::rk4_step_xc/CScriptInstance::call_xc),
for a block with xc_count > 0. See the module doc comment, “The optional
continuous-state (xc) contract.”