Skip to main content

Host

Trait Host 

Source
pub trait Host {
Show 16 methods // Required methods fn dispatch(&mut self, d: &Dispatch<'_>) -> Reply; fn store(&self) -> SharedStore; fn set_waker(&mut self, waker: Waker); // Provided methods fn journal(&self) -> Option<&Journal> { ... } fn journal_mut(&mut self) -> Option<&mut Journal> { ... } fn publish( &mut self, source: &str, cause: Option<Seq>, name: &str, data: Json, ) -> Option<Seq> { ... } fn since(&self, seq: Seq) -> Option<Vec<Event>> { ... } fn last_seq(&self) -> Option<Seq> { ... } fn history(&mut self) -> Option<&mut dyn History> { ... } fn set_job_publisher(&mut self, publisher: JobPublisher) { ... } fn layout_document(&self) -> Option<String> { ... } fn contexts(&mut self) -> Option<&mut dyn Contexts> { ... } fn clipboard(&mut self) -> Option<&mut dyn Clipboard> { ... } fn begin_group(&mut self, origin: &Origin, label: &str) -> Option<GestureId> { ... } fn groups(&self) -> Option<Rc<dyn Groups>> { ... } fn end_group(&mut self, group: GestureId, keep: bool) { ... }
}
Expand description

The application’s kernel, as the interface sees it.

Required Methods§

Source

fn dispatch(&mut self, d: &Dispatch<'_>) -> Reply

Runs a command (its when already holds in d.context).

Source

fn store(&self) -> SharedStore

The value store holding settings and values.

Source

fn set_waker(&mut self, waker: Waker)

How to wake the interface; the host calls it from any thread when a result or an event arrives.

Provided Methods§

Source

fn journal(&self) -> Option<&Journal>

The host’s journal, when it keeps one in memory (LocalHost does). None (the default): the host answers publish, since and last_seq from its own bus, or keeps no journal and egui-pop keeps one.

Source

fn journal_mut(&mut self) -> Option<&mut Journal>

The host’s journal, to append to.

Source

fn publish( &mut self, source: &str, cause: Option<Seq>, name: &str, data: Json, ) -> Option<Seq>

Appends an event to the host’s journal; its sequence number, or None when the host keeps no journal (egui-pop’s in-memory one keeps the event then).

Source

fn since(&self, seq: Seq) -> Option<Vec<Event>>

The events after seq, oldest first; None when the host keeps no journal.

Source

fn last_seq(&self) -> Option<Seq>

The last sequence number given (0: none yet); None when the host keeps no journal.

Source

fn history(&mut self) -> Option<&mut dyn History>

The owner of the application’s histories (ADR 0014), when the kernel keeps them. None (the default): egui-pop’s StoreHistory over Host::store, which keeps its newest HISTORY_CAP (500) steps per history; a host keeps more or fewer with Store::set_history_cap. egui-pop owns the keys, the commands and the steps around them (edit.undo, edit.redo, edit.jump); the owner says what an undo is.

Source

fn set_job_publisher(&mut self, publisher: JobPublisher)

Where the host says its jobs: the application hands it the publisher of pop.job.event when it is built. A host whose kernel runs jobs keeps it and publishes each job fact on it, typed (JobEventKind), from any thread; the jobs centre follows those events only, never journal entries by their name. Ignored by default.

Source

fn layout_document(&self) -> Option<String>

The document the workbench’s layout is kept in, under the application’s persistence directory (AppBuilder::persist): LAYOUT_DOCUMENT by default, a workspace’s own (workspaces/photos/layout), asked again at each load and save. None: egui-pop neither loads nor saves the layout; the host keeps it (AppHandle::layout, AppHandle::set_layout). Loading and saving are the layout.load and layout.save steps.

Source

fn contexts(&mut self) -> Option<&mut dyn Contexts>

The owner of the context stack (places and modes, ADR 0012), when the application’s kernel keeps it. None (the default): egui-pop’s own LocalContexts, kept by ContextsPlugin. The interface only reads it and asks it for transitions; it never writes the stack.

Source

fn clipboard(&mut self) -> Option<&mut dyn Clipboard>

The owner of the clipboard (ADR 0015), when the application’s kernel keeps it. None (the default): egui-pop’s own LocalClipboard, kept by ClipboardPlugin.

Source

fn begin_group(&mut self, origin: &Origin, label: &str) -> Option<GestureId>

Opens a history group labelled label (“Paste a colour”): what is written in it until Host::end_group is one undo step. egui-pop opens one around a paste and around a cut’s delete, and AppHandle::group opens one for the application; the writes carry it (Set::gesture). The default opens one through Host::groups, else a group of the store; None: the host groups nothing.

Source

fn groups(&self) -> Option<Rc<dyn Groups>>

The history groups of a host keeping its own history, for the groups a command opens while the host dispatches it (Call::group). None (the default): such groups are the store’s, as the default Host::begin_group’s are; a host overriding begin_group gives its groups here too, so a command’s groups reach its history.

Source

fn end_group(&mut self, group: GestureId, keep: bool)

Ends a history group: kept as one undo step, or (keep false) put back as it was.

Implementors§