pub struct TabBar<TabId: Clone + PartialEq> {
pub tabs: Vec<Tab<TabId>>,
pub active: TabId,
}Expand description
A horizontal tab strip.
TabBar is generic over TabId so that applications can use any
Clone + PartialEq type — typically a small enum.
§Example
use snora_core::{Tab, TabBar};
#[derive(Clone, PartialEq, Eq, Debug)]
enum WorkspaceTab { Library, Editor }
let bar = TabBar {
tabs: vec![
Tab { id: WorkspaceTab::Library, label: "Library".into(), icon: None },
Tab { id: WorkspaceTab::Editor, label: "Editor".into(), icon: None },
],
active: WorkspaceTab::Library,
};
assert_eq!(bar.tabs.len(), 2);
assert_eq!(bar.active, WorkspaceTab::Library);Fields§
§tabs: Vec<Tab<TabId>>Tabs in display order. The widget engine respects this order;
horizontal mirroring under crate::LayoutDirection::Rtl is
the engine’s responsibility.
active: TabIdThe currently selected tab id. The widget renders this tab with
an active treatment (typically an underline). If active does
not match any tab in tabs, no tab is highlighted.
Trait Implementations§
Auto Trait Implementations§
impl<TabId> Freeze for TabBar<TabId>
impl<TabId> RefUnwindSafe for TabBar<TabId>
impl<TabId> Send for TabBar<TabId>
impl<TabId> Sync for TabBar<TabId>
impl<TabId> Unpin for TabBar<TabId>
impl<TabId> UnsafeUnpin for TabBar<TabId>
impl<TabId> UnwindSafe for TabBar<TabId>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more