pub trait PanelView:
'static
+ Send
+ Sync {
Show 13 methods
// Required methods
fn panel_name(&self, cx: &App) -> &'static str;
fn panel_id(&self, cx: &App) -> PanelId;
fn closable(&self, cx: &App) -> bool;
fn zoomable(&self, cx: &App) -> bool;
fn visible(&self, cx: &App) -> bool;
fn set_active(&self, active: bool, window: &mut Window, cx: &mut App);
fn set_zoomed(&self, zoomed: bool, window: &mut Window, cx: &mut App);
fn on_added_to(
&self,
group: WeakEntity<TabGroup>,
window: &mut Window,
cx: &mut App,
);
fn on_removed(&self, window: &mut Window, cx: &mut App);
fn view(&self) -> AnyView;
fn focus_handle(&self, cx: &App) -> FocusHandle;
fn dump(&self, cx: &App) -> PanelState;
fn as_any(&self) -> &dyn Any;
}Expand description
Object-safe counterpart of Panel, used to hold heterogeneous panel
entities behind a single handle.
Required Methods§
fn panel_name(&self, cx: &App) -> &'static str
fn panel_id(&self, cx: &App) -> PanelId
fn closable(&self, cx: &App) -> bool
fn zoomable(&self, cx: &App) -> bool
fn visible(&self, cx: &App) -> bool
fn set_active(&self, active: bool, window: &mut Window, cx: &mut App)
fn set_zoomed(&self, zoomed: bool, window: &mut Window, cx: &mut App)
fn on_added_to( &self, group: WeakEntity<TabGroup>, window: &mut Window, cx: &mut App, )
fn on_removed(&self, window: &mut Window, cx: &mut App)
fn view(&self) -> AnyView
fn focus_handle(&self, cx: &App) -> FocusHandle
fn dump(&self, cx: &App) -> PanelState
Sourcefn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
The concrete value behind this handle.
A layer above base cannot recover its own richer panel trait object
from this one: Arc<dyn some_skin::PanelView> coerces to
Arc<dyn PanelView>, and Rust has no coercion back — a sub-trait
object cannot be recovered from a super-trait object. The registry
documents the same wall one layer in.
So a layer that needs more off a panel than this trait carries defines
a concrete handle type, implements this trait for it by delegation,
hands base that, and recovers it here with
panel.as_any().downcast_ref::<ItsOwnHandle>(). That downcast works
precisely because the type it names is concrete.
The blanket implementation for Entity<T> answers with the entity, so
a caller that knows the panel type can recover Entity<T> instead.
Which of the two a given handle holds is not fixed: a failed
downcast_ref means only that this handle was built by someone else,
and every caller needs a path for that.
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".