pub struct TabItem {
pub id: SharedString,
pub label: SharedString,
pub icon: Option<Icon>,
pub badge: Option<SharedString>,
pub disabled: bool,
pub save_state: SaveState,
pub closable: bool,
}Expand description
One tab, identified by business identity rather than by position.
Fields§
§id: SharedString§label: SharedString§icon: Option<Icon>§badge: Option<SharedString>§disabled: bool§save_state: SaveState§closable: boolImplementations§
Source§impl TabItem
impl TabItem
pub fn new(id: impl Into<SharedString>, label: impl Into<SharedString>) -> Self
pub fn icon(self, icon: Icon) -> Self
Sourcepub fn badge(self, badge: impl Into<SharedString>) -> Self
pub fn badge(self, badge: impl Into<SharedString>) -> Self
A count shown next to the label, such as how many items the tab holds.
pub fn disabled(self, disabled: bool) -> Self
Sourcepub fn save_state(self, state: SaveState) -> Self
pub fn save_state(self, state: SaveState) -> Self
Whether what this tab holds has been written down.
Sourcepub fn saving(self) -> Self
pub fn saving(self) -> Self
A save is in flight. Distinct from clean, because it has not landed.
Sourcepub fn save_failed(self, reason: impl Into<SharedString>) -> Self
pub fn save_failed(self, reason: impl Into<SharedString>) -> Self
A save was attempted and did not land, in the host’s own words.
Sourcepub fn closable(self, closable: bool) -> Self
pub fn closable(self, closable: bool) -> Self
Whether this tab carries a close affordance.
Closing is reported through Tabs::on_close; a strip with no such
handler draws no close control however many tabs claim to be closable.
Trait Implementations§
impl Eq for TabItem
impl StructuralPartialEq for TabItem
Auto Trait Implementations§
impl Freeze for TabItem
impl RefUnwindSafe for TabItem
impl Send for TabItem
impl Sync for TabItem
impl Unpin for TabItem
impl UnsafeUnpin for TabItem
impl UnwindSafe for TabItem
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more