Skip to main content

EditorContext

Struct EditorContext 

Source
pub struct EditorContext<'a> { /* private fields */ }
Expand description

The Editor, as a panel’s command, a tool or a panel told of an edit sees it: the program and what it built, and the few ways they change that the editor keeps track of — so that undo, the marker and the step being edited stay right whatever the extension does.

Implementations§

Source§

impl<'a> EditorContext<'a>

Source

pub fn program(&self) -> &Program

The program, as saved: the file edited.

Source

pub fn part(&self) -> Reader<'_>

The part the program builds, as far as it last ran.

Source

pub fn drawn(&self) -> Option<Visible<'_>>

The part as last drawn, but what the viewer was told not to draw: what a tool picks in.

Source

pub fn runs(&self) -> u64

How many times the editor has run the program: what the part is built as changes only when this does.

Source

pub fn idle(&self) -> GeopResult<()>

Refuses while a step is edited.

Source

pub fn run_all(&mut self)

Runs the whole of the program run now: the step edited’s, or the file’s.

Source

pub fn rerun(&mut self) -> Rerun<'_>

The program run now — the step edited’s, or the file’s — with the part as it last ran, to run again.

Source

pub fn move_state(&mut self, moved: StateValues)

Moves the file’s state to moved, where it says.

Source

pub fn edit_program( &mut self, edit: impl Fn(&mut Program) -> GeopResult<()>, ) -> GeopResult<()>

Edits the file — and the program of the step being edited, which then sees the edit too — by edit. The marker and the step edited stay at their steps, found again by id: an edit may move steps.

Source

pub fn undoable(&mut self, before: Program)

Makes the file going back to before one edit to undo — what a drag of many events is — if it changed since.

Source

pub fn inspect( &mut self, kind: &str, picked: &[PickedElement], ) -> GeopResult<Inspection>

The answer of the inspector kind about the elements picked of the part as far as it runs.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for EditorContext<'a>

§

impl<'a> !Send for EditorContext<'a>

§

impl<'a> !Sync for EditorContext<'a>

§

impl<'a> !UnwindSafe for EditorContext<'a>

§

impl<'a> Freeze for EditorContext<'a>

§

impl<'a> Unpin for EditorContext<'a>

§

impl<'a> UnsafeUnpin for EditorContext<'a>

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