Skip to main content

PatchBuilder

Struct PatchBuilder 

Source
pub struct PatchBuilder { /* private fields */ }
Expand description

Builds a StylePatch with the same setters the element builders have, for static values only.

A variant method such as hover hands a fresh builder to the closure the caller passes and takes the builder back when the closure returns it, so a patch reads as a chain: |p| p.background(color).border(1.0).

Implementations§

Source§

impl PatchBuilder

Source

pub fn width(self, width: Length) -> Self

Sets the width. This takes part in layout.

Source

pub fn height(self, height: Length) -> Self

Sets the height. This takes part in layout.

Source

pub fn size(self, size: Size) -> Self

Sets the width and the height, in logical pixels. This takes part in layout.

Source

pub fn min_width(self, width: Length) -> Self

Sets the lower bound of the width. This takes part in layout.

Source

pub fn min_height(self, height: Length) -> Self

Sets the lower bound of the height. This takes part in layout.

Source

pub fn max_width(self, width: Length) -> Self

Sets the upper bound of the width. This takes part in layout.

Source

pub fn max_height(self, height: Length) -> Self

Sets the upper bound of the height. This takes part in layout.

Source

pub fn padding(self, padding: Length) -> Self

Sets the same padding on all four sides. This takes part in layout.

Source

pub fn padding_xy(self, padding: Size) -> Self

Sets the horizontal padding from width and the vertical padding from height. This takes part in layout.

Source

pub fn margin(self, margin: Length) -> Self

Sets the same margin on all four sides. This takes part in layout.

Source

pub fn gap(self, gap: Size) -> Self

Sets the space between adjacent children. This takes part in layout.

Source

pub fn direction(self, direction: Direction) -> Self

Sets the main axis of the children’s layout. This takes part in layout.

Source

pub fn row(self) -> Self

Lays the children out left to right. This takes part in layout.

Source

pub fn column(self) -> Self

Lays the children out top to bottom. This takes part in layout.

Source

pub fn wrap(self, wrap: bool) -> Self

Lets children that do not fit move to a new line instead of shrinking. This takes part in layout.

Source

pub fn grow(self, grow: f32) -> Self

Sets the share of the leftover space on the main axis this node takes. This takes part in layout.

Source

pub fn shrink(self, shrink: f32) -> Self

Sets how readily this node gives up space when its siblings overflow. This takes part in layout.

Source

pub fn basis(self, basis: Length) -> Self

Sets the main axis size the node starts from before growing or shrinking. This takes part in layout.

Source

pub fn align_items(self, align: Align) -> Self

Sets how the children line up across the main axis. This takes part in layout.

Source

pub fn justify_content(self, justify: Justify) -> Self

Sets how the children are spread along the main axis. This takes part in layout.

Source

pub fn absolute(self) -> Self

Takes the node out of normal flow, so its insets place it against its containing block. This takes part in layout.

Source

pub fn inset(self, inset: Edges<Length>) -> Self

Sets the offsets from the containing block’s edges. This takes part in layout.

Source

pub fn border(self, width: f32) -> Self

Sets the border width, the same on all four sides. This takes part in layout, because the border takes space away from the content.

Source

pub fn clip(self, clip: bool) -> Self

Clips the children to the node’s bounds. This takes part in layout.

Source

pub fn hidden(self, hidden: bool) -> Self

Hides the node and its subtree, or shows them again. This takes part in layout.

Source

pub fn background(self, color: impl Into<ColorValue>) -> Self

Sets the fill painted behind the node.

The color can be a Color or a ColorToken. A token resolves against the theme that is current when the node paints.

Source

pub fn border_color(self, color: impl Into<ColorValue>) -> Self

Sets the color of the border whose width PatchBuilder::border sets.

The color can be a Color or a ColorToken. A token resolves against the theme that is current when the node paints.

Source

pub fn text_color(self, color: impl Into<ColorValue>) -> Self

Sets the color a widget’s text paints with.

Widgets that show text read it; widgets without text ignore it. The color can be a Color or a ColorToken. A token resolves against the theme that is current when the node paints.

Source

pub fn corner_radius(self, radius: impl Into<RadiusValue>) -> Self

Sets the corner radius of the background and the border, the same on all four corners.

The radius can be an f32 or a RadiusToken. A token resolves against the theme that is current when the node paints.

Trait Implementations§

Source§

impl Default for PatchBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.