pub struct Executor { /* private fields */ }Expand description
Executes a compiled program against a target. Construct one with
from_bytes, from_bytecode,
or from_program, then call
run.
Implementations§
Source§impl Executor
impl Executor
Sourcepub fn from_bytes(
config: ExecutorConfig,
bytes: &[u8],
) -> Result<Self, RuntimeError>
pub fn from_bytes( config: ExecutorConfig, bytes: &[u8], ) -> Result<Self, RuntimeError>
Decode a raw .rbc byte buffer and build an executor from it.
Fails with RuntimeError::Bytecode if the bytes are not a valid
program for this runtime version.
Sourcepub fn from_bytecode(
config: ExecutorConfig,
program: BytecodeProgram,
) -> Result<Self, RuntimeError>
pub fn from_bytecode( config: ExecutorConfig, program: BytecodeProgram, ) -> Result<Self, RuntimeError>
Build an executor from an already-decoded BytecodeProgram. Prefer
from_program when running one program
against many targets.
Sourcepub fn from_program(
config: ExecutorConfig,
program: Arc<BytecodeProgram>,
) -> Result<Self, RuntimeError>
pub fn from_program( config: ExecutorConfig, program: Arc<BytecodeProgram>, ) -> Result<Self, RuntimeError>
Construct an executor sharing a pre-built Arc<BytecodeProgram>.
Prefer this over Executor::from_bytecode when a single compiled
script is run against many targets: the program (and the regex caches
derived from it) are cloned via Arc rather than deep-copied.
pub fn bytecode(&self) -> &BytecodeProgram
Sourcepub async fn run(&self) -> Result<ExecutionResult, RuntimeError>
pub async fn run(&self) -> Result<ExecutionResult, RuntimeError>
Execute the program against the configured target and return the
ExecutionResult. Probes that must reach a closed port short-circuit
to a skipped result; an assert/fail or transport error returns
Err.