Skip to main content

ProgramRunner

Struct ProgramRunner 

Source
pub struct ProgramRunner<S: Scalar> { /* private fields */ }
Expand description

Builds a program the way an editor needs it built: incrementally, and only as far as asked.

It keeps the part after every step it has run. Running again after an edit reuses the part after the longest unchanged prefix of steps, so changing the last step replays one step, not the whole history. And a run can stop early — while a step in the middle is being edited, only the steps up to it need to run, however long the rest of the program is. Parts past the stop are kept, not discarded, so moving the stop back again costs nothing.

A run stops at the first step that fails: the steps after it would only fail too, for want of what it should have built.

Implementations§

Source§

impl<S: Scalar> ProgramRunner<S>

Source

pub fn new() -> Self

Source

pub fn run(&mut self, program: &Program, stop: Option<usize>)

Runs the first stop steps of program — all of them if None — reusing whatever the previous runs built that still applies. See ProgramRunner::part and ProgramRunner::results for the outcome.

Source

pub fn part(&self) -> &Part<S>

The part the last run built.

Source

pub fn results(&self) -> &[StepResult]

One result per step the last run covered.

Source

pub fn handles(&self) -> GeopResult<Vec<StepHandle>>

Every handle of every step the last run built — all of them, of every group: which to offer is an editor’s choice. Each is placed with the part as its step saw it.

Trait Implementations§

Source§

impl<S: Scalar> Default for ProgramRunner<S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S> Freeze for ProgramRunner<S>

§

impl<S> RefUnwindSafe for ProgramRunner<S>
where S: RefUnwindSafe,

§

impl<S> Send for ProgramRunner<S>

§

impl<S> Sync for ProgramRunner<S>

§

impl<S> Unpin for ProgramRunner<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for ProgramRunner<S>

§

impl<S> UnwindSafe for ProgramRunner<S>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.