Skip to main content

Editor

Struct Editor 

Source
pub struct Editor { /* private fields */ }
Expand description

Editing a program: see the module docs.

Implementations§

Source§

impl Editor

Source

pub fn new(registry: Registry, files: impl FileStoreMut + 'static) -> Self

An editor of what registry offers, editing a program of no steps, the files it places parts from read from files, what they are made into kept in memory.

Source

pub fn with_cache( registry: Registry, files: impl FileStoreMut + 'static, cache: Cache, ) -> Self

Editor::new, what its files are made into kept in cache: a host process’s, kept on disk too.

Source

pub fn program(&self) -> &Program

Source

pub fn forget_viewer(&mut self)

Forgets what the viewer was sent: the next update sends all of the scene, as to a viewer that has nothing — one starting afresh, or one that never saw the updates someone else asked for (see crate::agent::Session::new).

Source

pub fn registry(&self) -> &Registry

What it offers.

Source

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

The part the program builds, as far as it runs now.

Source

pub fn counts(&self) -> Counts

How much work its runs have done: what a test bounds an edit by.

Source

pub fn editing(&self) -> Option<&ProgramStep>

The step being edited, with its arguments as they now are.

Source

pub fn step_editor(&self) -> Option<&StepEditor>

The step editor of the step being edited: its operation’s editing state among what it keeps.

Source

pub fn tool<T: Tool>(&self) -> Option<&T>

The tool in hand, if it is a T.

Source

pub fn handle_json(&mut self, command: &str) -> Result<String, String>

Editor::handle on the wire: command is a Command as JSON, and the answer an Update as JSON. Shared by every front end that is not Rust (the browser’s wasm module, the VS Code host process), so they all speak the same protocol. Err is a message that is not itself an update: the command could not be read, or the update not written.

Source

pub fn handle(&mut self, command: Command) -> Update

Applies command, and says what to show now.

Auto Trait Implementations§

§

impl !Freeze for Editor

§

impl !RefUnwindSafe for Editor

§

impl !Send for Editor

§

impl !Sync for Editor

§

impl !UnwindSafe for Editor

§

impl Unpin for Editor

§

impl UnsafeUnpin for Editor

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.