pub struct Loadable<I, M: Composite> { /* private fields */ }Expand description
A program image and the composite that executes its borrowed instructions.
Construct the image explicitly before pairing it with a machine. Only
Image is supported; the image remains unchanged throughout an invocation.
Ordinary outer structs can own several loadables with different instruction
sets. Section selection and image construction remain caller responsibilities.
Implementations§
Source§impl<Inst, V, Ty, Info, M: Composite> Loadable<Image<Inst, V, Ty, Info>, M>
impl<Inst, V, Ty, Info, M: Composite> Loadable<Image<Inst, V, Ty, Info>, M>
Sourcepub fn image(&self) -> &Image<Inst, V, Ty, Info>
pub fn image(&self) -> &Image<Inst, V, Ty, Info>
Inspect the paired image without changing an invocation’s program data.
Sourcepub fn machine_mut(&mut self) -> &mut M
pub fn machine_mut(&mut self) -> &mut M
Configure the execution machine or its devices.
Direct changes to execution state can affect whether an invocation can resume. The caller is responsible for keeping those changes consistent with the paired image.
Sourcepub fn into_parts(self) -> (Image<Inst, V, Ty, Info>, M)
pub fn into_parts(self) -> (Image<Inst, V, Ty, Info>, M)
Consume the owner, returning its image and machine without resetting them.
Source§impl<Inst, V, Ty, Info, M> Loadable<Image<Inst, V, Ty, Info>, M>
impl<Inst, V, Ty, Info, M> Loadable<Image<Inst, V, Ty, Info>, M>
Sourcepub fn new(image: Image<Inst, V, Ty, Info>, machine: M) -> Self
pub fn new(image: Image<Inst, V, Ty, Info>, machine: M) -> Self
Pair an image with a machine, resetting its previous invocation state.
Device state is retained. No parsing, lowering, or image validation is performed here; construction of a valid image is the caller’s job.
Sourcepub fn replace_image(&mut self, image: Image<Inst, V, Ty, Info>) -> Result<()>
pub fn replace_image(&mut self, image: Image<Inst, V, Ty, Info>) -> Result<()>
Install an already constructed image and reset execution state.
Device state is retained. Image construction happens before this call; mutations made by the caller while constructing it are not rolled back.
§Errors
Rejects replacement while an invocation is active, including one that
could resume after an execution error. Call Self::reset to abandon
that invocation first. Rejection leaves the current image and execution
state unchanged.
Source§impl<Inst, V, Ty, Info, M> Loadable<Image<Inst, V, Ty, Info>, M>where
M: HasProgram<Program = ExecutionState> + Dispatch<LocalModule<Inst, V, Ty, Info>, Instruction = Inst>,
impl<Inst, V, Ty, Info, M> Loadable<Image<Inst, V, Ty, Info>, M>where
M: HasProgram<Program = ExecutionState> + Dispatch<LocalModule<Inst, V, Ty, Info>, Instruction = Inst>,
Sourcepub fn execute(&mut self, arguments: &[Word]) -> Result<()>
pub fn execute(&mut self, arguments: &[Word]) -> Result<()>
Start at the program entrypoint with the supplied arguments.
Instructions and metadata borrow the image while dispatch mutates the separate machine. No instruction cloning is required.
§Errors
Returns the runner’s entry or execution errors. Earlier machine mutations are retained; reset or resume according to the invocation’s state.