pub enum TabSizing {
Shared,
Independent,
Fill,
}Expand description
How wide each tab is: shared across all unpinned tabs, chosen per-tab from content, or stretched to fill the bar.
Shared and Independent size the layout axis (width in
horizontal bars, height in vertical bars); Fill sizes the tab’s
width in both orientations — see each variant. See the module
docs of crate::tab_widget for how this is applied per
orientation. In wrap (multi-line horizontal) mode Independent is
forced regardless of this setting — equal-width tabs in a wrapping
row look like a tile grid and lose the bookmark-bar / pill-strip
aesthetic.
Variants§
All non-pinned tabs share the same extent on the layout axis.
The available region is divided equally across the unpinned
count, then clamped to [min_tab_extent, max_tab_extent].
Below the min, content overflows into scroll. Above the max,
slack is left as empty space at the trailing edge.
In a vertical bar the layout axis is the pill height, so
this yields uniform pills whose width fits the widest label
(clamped to [min_tab_width, max_tab_width]).
Independent
Each tab sizes to its content (icon + label + slots), clamped
to [min_tab_extent, max_tab_extent]. Truncation via ellipsis
when content hits max.
Fill
Tabs stretch to the full width the bar is offered — no slack left over, no fit-to-content shrinking. The nav-rail / segmented-control look (VS Code’s settings sidebar, a full-bleed tab strip).
- Horizontal: the viewport width is divided equally across
the unpinned tabs and
max_tab_widthis not applied, so the strip is filled edge to edge instead of leaving trailing slack.min_tab_widthstill holds — below it the headers overflow into scroll rather than squeezing to nothing. - Vertical: every pill takes the bar’s full proposed width
(the widest-label clamp is bypassed), so the tabs span the
sidebar. Pill height is unchanged (the intrinsic
editor_tab_height, or thetab_bar_heightoverride).
With no width proposed at all (an unbounded measure — a
Center, an HStack asking for the natural size), there is
nothing to fill: a vertical bar falls back to the Shared
fit-to-widest-label width. Give the bar a bounded width (a
FixedSize, an Expand in a sized parent) for Fill to have
any effect.
Trait Implementations§
impl Copy for TabSizing
impl Eq for TabSizing
impl StructuralPartialEq for TabSizing
Auto Trait Implementations§
impl Freeze for TabSizing
impl RefUnwindSafe for TabSizing
impl Send for TabSizing
impl Sync for TabSizing
impl Unpin for TabSizing
impl UnsafeUnpin for TabSizing
impl UnwindSafe for TabSizing
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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