Skip to main content

Loadable

Struct Loadable 

Source
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>

Source

pub fn image(&self) -> &Image<Inst, V, Ty, Info>

Inspect the paired image without changing an invocation’s program data.

Source

pub fn machine(&self) -> &M

Inspect the execution machine and its devices.

Source

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.

Source

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>
where M: Composite + HasProgram<Program = ExecutionState>,

Source

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.

Source

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

pub fn reset(&mut self)

Abandon the invocation, retaining the image and all device state.

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>,

Source

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.

Source

pub fn resume(&mut self) -> Result<()>

Continue the existing invocation against the same paired image.

§Errors

Returns the runner’s state, instruction-fetch, or dispatch errors without rolling back machine mutations. A halted invocation remains halted.

Trait Implementations§

Source§

impl<I: Debug, M: Debug + Composite> Debug for Loadable<I, M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<I, M> Freeze for Loadable<I, M>
where I: Freeze, M: Freeze,

§

impl<I, M> RefUnwindSafe for Loadable<I, M>

§

impl<I, M> Send for Loadable<I, M>
where I: Send, M: Send,

§

impl<I, M> Sync for Loadable<I, M>
where I: Sync, M: Sync,

§

impl<I, M> Unpin for Loadable<I, M>
where I: Unpin, M: Unpin,

§

impl<I, M> UnsafeUnpin for Loadable<I, M>
where I: UnsafeUnpin, M: UnsafeUnpin,

§

impl<I, M> UnwindSafe for Loadable<I, M>
where I: UnwindSafe, M: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<D> Apply<PushToStack<()>> for D

Source§

fn apply(&mut self, _: PushToStack<()>)

Apply a single effect to this destination.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

§

type Proj<U: 'src> = U

§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.