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
Everything gpui_base::dock exports, so a consumer never has to depend
on the foundation crate directly to write a skin or read a container’s
state. Kept in step with base’s own list by
every_base_dock_export_is_reachable_from_here.
Two names are handled elsewhere and one is deliberately absent:
base’s Panel and PanelView arrive as BasePanel and BasePanelView
because this module’s Panel/PanelView are the presentation halves that
extend them, and base’s Dock — a plain state struct holding one dock’s
open, collapsible, size and resizing flags — is not re-exported at all,
because the name meant a panel container in every released version of this
crate and handing it back with a different meaning is worse than dropping
it. A skin reads a dock through DockContext.
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§
fn panel_name(&self, id: PanelId) -> &'static str
fn is_visible(&self, id: PanelId) -> bool
fn dump(&self, id: PanelId) -> PanelState
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".