pub trait TabContent: 'static {
// Required methods
fn render(
&self,
focused: bool,
window: &mut Window,
cx: &mut App,
) -> AnyElement;
fn title(&self) -> SharedString;
}Expand description
Content rendered inside a single tab of a Pane.
Object-safe by design (no generics, no Self return type) so Pane can
hold a heterogeneous Vec<Box<dyn TabContent>>.
§Example
ⓘ
struct FileTab { path: SharedString }
impl TabContent for FileTab {
fn render(&self, _focused: bool, _window: &mut Window, _cx: &mut App) -> AnyElement {
div().child(self.path.clone()).into_any_element()
}
fn title(&self) -> SharedString { self.path.clone() }
}Required Methods§
Sourcefn render(&self, focused: bool, window: &mut Window, cx: &mut App) -> AnyElement
fn render(&self, focused: bool, window: &mut Window, cx: &mut App) -> AnyElement
Renders this tab’s body. focused is true when this tab is the
active tab of a Pane that is itself PaneGroup’s active pane.
Sourcefn title(&self) -> SharedString
fn title(&self) -> SharedString
The label shown on the tab strip.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".