Skip to main content

Contexts

Trait Contexts 

Source
pub trait Contexts {
    // Required methods
    fn registry(&self) -> FrameRegistry;
    fn state(&self) -> State;
    fn request(&mut self, envelope: &Envelope, origin: &Origin) -> Answer;

    // Provided methods
    fn rev(&self) -> u64 { ... }
    fn holds(&self) -> Vec<Hold> { ... }
    fn hold(
        &mut self,
        _groups: Vec<GroupId>,
        _reason: &str,
        _by: &str,
    ) -> Result<u64, String> { ... }
    fn release(&mut self, _token: u64) -> bool { ... }
    fn declare(
        &mut self,
        _owner: &OwnerId,
        _spec: FrameSpec,
    ) -> Result<(), String> { ... }
    fn remove_owner(&mut self, _owner: &OwnerId) { ... }
    fn take_events(&mut self) -> Vec<(String, Json)> { ... }
}
Expand description

The owner of the context stack, as the interface reaches it.

Required Methods§

Source

fn registry(&self) -> FrameRegistry

The frames that exist.

Source

fn state(&self) -> State

The stack now.

Source

fn request(&mut self, envelope: &Envelope, origin: &Origin) -> Answer

Applies a transition, or refuses it. The owner writes the new stack before it answers, then publishes (see Contexts::take_events).

Provided Methods§

Source

fn rev(&self) -> u64

Its revision (the projection follows it).

Source

fn holds(&self) -> Vec<Hold>

The holds in force.

Source

fn hold( &mut self, _groups: Vec<GroupId>, _reason: &str, _by: &str, ) -> Result<u64, String>

Holds groups (empty: everything; PLACES for places): its token.

Source

fn release(&mut self, _token: u64) -> bool

Releases a hold; whether it was held.

Source

fn declare(&mut self, _owner: &OwnerId, _spec: FrameSpec) -> Result<(), String>

A plugin declares a frame (Ctx::frame).

Source

fn remove_owner(&mut self, _owner: &OwnerId)

A plugin is gone: its frames go.

Source

fn take_events(&mut self) -> Vec<(String, Json)>

The events to publish since the last call, as (name, data): egui-pop publishes them on the host’s journal. An owner publishing on its own bus gives none.

Implementors§