Skip to main content

PanelSource

Trait PanelSource 

Source
pub trait PanelSource {
    // Required methods
    fn panel_name(&self, id: PanelId) -> &'static str;
    fn is_visible(&self, id: PanelId) -> bool;
    fn dump(&self, id: PanelId) -> PanelState;
}
Expand description

Both halves of the persistence seam. PaneTree::to_state reads panel properties through PanelSource; PaneTree::from_state turns persisted leaves back into panels through PanelBuilder. Exporting only the first left from_state public but uncallable, since no caller outside this crate could name the trait its parameter requires. How the layout tree reads properties of panels it only knows by id.

Keeping this behind a trait is what lets the whole layout algebra be tested without an App.

Required Methods§

Source

fn panel_name(&self, id: PanelId) -> &'static str

Source

fn is_visible(&self, id: PanelId) -> bool

Source

fn dump(&self, id: PanelId) -> PanelState

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§