Skip to main content

Driver

Struct Driver 

Source
pub struct Driver<D> { /* private fields */ }
Expand description

Bounded iterative instruction driver.

Implementations§

Source§

impl<D> Driver<D>

Source

pub fn new(policy: D) -> Self

Creates a driver around consumer-owned instruction semantics.

Source

pub fn drive<P, M, A, F>( &mut self, description: &MachineDescription<'_, P, M>, permit: &MachinePermit, frames: &mut FrameStack<F>, work: WorkLimit, ) -> DriveResult<P::InstructionId, D::Return, D::Abrupt, D::Yield, D::Interrupt, D::Fault>

Drives at most work instructions without recursive guest execution.

Source

pub fn drive_with_safepoints<P, M, A, F, S>( &mut self, description: &MachineDescription<'_, P, M>, permit: &MachinePermit, frames: &mut FrameStack<F>, work: WorkLimit, root_budget: WorkLimit, observe: impl FnMut(&RootSnapshot) -> Result<(), S>, ) -> Result<DriveOutcome<P::InstructionId, D::Return, D::Abrupt, D::Yield, D::Interrupt>, SafepointDriveError<P::InstructionId, D::Fault, S>>

Drives one bounded slice, publishing a complete root view immediately before every prepared instruction marked as a safepoint.

The observer owns policy: this organ neither selects nor names a reclamation implementation. Suspended caller frames remain in frames and are therefore included in every view.

Source

pub fn drive_protected<P, M, A, F>( &mut self, description: &MachineDescription<'_, P, M>, permit: &MachinePermit, frames: &mut FrameStack<F>, work: WorkLimit, ) -> DriveResult<P::InstructionId, D::Return, D::Abrupt, D::Yield, D::Interrupt, D::Fault>

Drives through prepared protected regions, selecting the innermost handler.

A handled raise remains visible in the receipt, then execution continues at the validated handler boundary. The abrupt value remains consumer-owned; policies place it in their frame’s handler state before returning Raise.

Source

pub fn drive_with_cleanup<P, M, A, F>( &mut self, description: &MachineDescription<'_, P, M>, permit: &MachinePermit, frames: &mut FrameStack<F>, work: WorkLimit, cleanups: CleanupStack<MachineUnwind<D::Return, D::Abrupt, D::Interrupt>>, ) -> DriveResult<P::InstructionId, D::Return, D::Abrupt, D::Yield, D::Interrupt, D::Fault>

Runs a protected drive and unwinds registered cleanups on every abrupt or terminal path. Yield is a suspension and therefore retains its dynamic extent.

Auto Trait Implementations§

§

impl<D> Freeze for Driver<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for Driver<D>
where D: RefUnwindSafe,

§

impl<D> Send for Driver<D>
where D: Send,

§

impl<D> Sync for Driver<D>
where D: Sync,

§

impl<D> Unpin for Driver<D>
where D: Unpin,

§

impl<D> UnsafeUnpin for Driver<D>
where D: UnsafeUnpin,

§

impl<D> UnwindSafe for Driver<D>
where D: 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<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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.