Skip to main content

StyledExt

Trait StyledExt 

Source
pub trait StyledExt: Styled + Sized {
Show 21 methods // Provided methods fn refine_style(self, style: &StyleRefinement) -> Self { ... } fn h_flex(self) -> Self { ... } fn v_flex(self) -> Self { ... } fn paddings<L>(self, paddings: impl Into<Edges<L>>) -> Self where L: Into<DefiniteLength> + Clone + Default + Debug + PartialEq { ... } fn margins<L>(self, margins: impl Into<Edges<L>>) -> Self where L: Into<DefiniteLength> + Clone + Default + Debug + PartialEq { ... } fn debug_red(self) -> Self { ... } fn debug_blue(self) -> Self { ... } fn debug_yellow(self) -> Self { ... } fn debug_green(self) -> Self { ... } fn debug_pink(self) -> Self { ... } fn debug_focused( self, focus_handle: &FocusHandle, window: &Window, cx: &App, ) -> Self { ... } fn font_thin(self) -> Self { ... } fn font_extralight(self) -> Self { ... } fn font_light(self) -> Self { ... } fn font_normal(self) -> Self { ... } fn font_medium(self) -> Self { ... } fn font_semibold(self) -> Self { ... } fn font_bold(self) -> Self { ... } fn font_extrabold(self) -> Self { ... } fn font_black(self) -> Self { ... } fn corner_radii(self, radius: Corners<Pixels>) -> Self { ... }
}

Provided Methods§

Source

fn refine_style(self, style: &StyleRefinement) -> Self

Source

fn h_flex(self) -> Self

Lays children out in a row, centered on the cross axis.

The centering is the desktop default for a row of controls — an icon beside its label lines up without either side asking for it — but it is not the mirror image of Self::v_flex, which leaves the cross axis stretching. A column placed in a row therefore does not take the row’s height: it takes its content’s height and is centered inside the row. When its content is taller than the row, it overflows equally above and below, so the column’s header is pushed off the top edge and clipped.

Give a full-height column h_full() (or the row items_start() / items_stretch()) whenever the child owns a header, a footer, or a scroll region that has to resolve against the row’s height.

use gpui_base::StyledExt as _;
use gpui::{ParentElement as _, Styled as _, div};

// A sidebar beside a detail pane, both spanning the full height.
div().h_flex().size_full().child(div().w_64().h_full());
Source

fn v_flex(self) -> Self

Lays children out in a column, stretching them across the cross axis.

Unlike Self::h_flex this installs no cross-axis alignment, so a child without a width fills the column. See h_flex for the asymmetry.

Source

fn paddings<L>(self, paddings: impl Into<Edges<L>>) -> Self

Source

fn margins<L>(self, margins: impl Into<Edges<L>>) -> Self

Source

fn debug_red(self) -> Self

Source

fn debug_blue(self) -> Self

Source

fn debug_yellow(self) -> Self

Source

fn debug_green(self) -> Self

Source

fn debug_pink(self) -> Self

Source

fn debug_focused( self, focus_handle: &FocusHandle, window: &Window, cx: &App, ) -> Self

Source

fn font_thin(self) -> Self

Source

fn font_extralight(self) -> Self

Source

fn font_light(self) -> Self

Source

fn font_normal(self) -> Self

Source

fn font_medium(self) -> Self

Source

fn font_semibold(self) -> Self

Source

fn font_bold(self) -> Self

Source

fn font_extrabold(self) -> Self

Source

fn font_black(self) -> Self

Source

fn corner_radii(self, radius: Corners<Pixels>) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<E: Styled> StyledExt for E