Skip to main content

TabBar

Struct TabBar 

Source
pub struct TabBar<'a> { /* private fields */ }
Expand description

A horizontal tab bar. The active tab is indicated by a sky-coloured underline and an inactive tab lights up on hover.

let mut selected = 0usize;
ui.add(TabBar::new(&mut selected, ["Overview", "Settings", "Activity"]));

Implementations§

Source§

impl<'a> TabBar<'a>

Source

pub fn new<I, S>(selected: &'a mut usize, tabs: I) -> Self
where I: IntoIterator<Item = S>, S: Into<WidgetText>,

Build a tab bar. Accepts any iterator of items that convert into WidgetText, so both static arrays and dynamic collections work:

let mut selected = 0usize;
ui.add(TabBar::new(&mut selected, ["Overview", "Settings"]));
let dynamic: Vec<String> = vec!["A".into(), "B".into()];
ui.add(TabBar::new(&mut selected, dynamic));

Trait Implementations§

Source§

impl<'a> Debug for TabBar<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Widget for TabBar<'a>

Source§

fn ui(self, ui: &mut Ui) -> Response

Allocate space, interact, paint, and return a Response. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for TabBar<'a>

§

impl<'a> RefUnwindSafe for TabBar<'a>

§

impl<'a> Send for TabBar<'a>

§

impl<'a> Sync for TabBar<'a>

§

impl<'a> Unpin for TabBar<'a>

§

impl<'a> UnsafeUnpin for TabBar<'a>

§

impl<'a> !UnwindSafe for TabBar<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.