Skip to main content

Panel

Trait Panel 

Source
pub trait Panel: 'static {
    type State: Serialize;
    type Command: DeserializeOwned;

    const KEY: &'static str;

    // Required methods
    fn state(&self, program: &Program, part: &Reader<'_>) -> Self::State;
    fn command(
        &self,
        ctx: &mut EditorContext<'_>,
        command: Self::Command,
    ) -> GeopResult<Changed>;

    // Provided methods
    fn details(&self, state: &Self::State) -> BTreeMap<String, String> { ... }
    fn after_edit(&self, _ctx: &mut EditorContext<'_>) { ... }
}
Expand description

A view of the program a front end shows beside the steps, and the commands it is sent from there (crate::editor::Command::Panel): the program’s parameters, the joints of an assembly. A front end looks its component up by Panel::KEY.

Required Associated Constants§

Source

const KEY: &'static str

The panel’s key: what its state is under in crate::editor::ProgramState::panels, and what its commands name.

Required Associated Types§

Source

type State: Serialize

What it shows.

Source

type Command: DeserializeOwned

What it is sent.

Required Methods§

Source

fn state(&self, program: &Program, part: &Reader<'_>) -> Self::State

What it shows of program, the part part reads being what the program built as far as it runs.

Source

fn command( &self, ctx: &mut EditorContext<'_>, command: Self::Command, ) -> GeopResult<Changed>

Does command, saying what it changed.

Provided Methods§

Source

fn details(&self, state: &Self::State) -> BTreeMap<String, String>

What the part’s structure says beside its items, by their names, from what the panel shows (state): how free a placed part is. Nothing, unless it says otherwise.

Source

fn after_edit(&self, _ctx: &mut EditorContext<'_>)

Told once an edit — after a command changed the program or the step being edited, once it has run again and settled — never for every move of the pointer: where a question about the whole of what was built is asked. Nothing, unless it says otherwise.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§