Skip to main content

LayoutBuilder

Struct LayoutBuilder 

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

Base builder for creating UI components and layouts

Implementations§

Source§

impl LayoutBuilder

Source

pub fn new(component_type: impl Into<String>) -> Self

Create a new layout builder with a component type

Source

pub fn attr(self, key: impl Into<String>, value: impl Into<PluginValue>) -> Self

Set an attribute on this layout

Source

pub fn attrs(self, attrs: &[(&str, PluginValue)]) -> Self

Set multiple attributes at once

Source

pub fn child(self, id: impl Into<String>, child: impl Builder) -> Self

Add a child component with an ID

Source

pub fn children( self, children: impl IntoIterator<Item = (String, PluginValue)>, ) -> Self

Add multiple children at once

Source

pub fn with_children(self, children: IndexMap<String, PluginValue>) -> Self

Set children from an existing map

Source§

impl LayoutBuilder

Extension methods for setting common attributes

Source

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

Set the width

Source

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

Set the height

Source

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

Set the padding

Source

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

Set the margin

Source

pub fn border(self, border: i64) -> Self

Set the border width

Source

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

Set the border color

Source

pub fn bg_color(self, color: impl Into<String>) -> Self

Set the background color

Source

pub fn shadow(self, shadow: impl Into<String>) -> Self

Set the shadow

Source

pub fn bind(self, property: impl Into<String>, path: impl Into<String>) -> Self

Set a data binding for a property

Source

pub fn on(self, event: impl Into<String>, handler: impl Into<String>) -> Self

Set an event handler

Trait Implementations§

Source§

impl Builder for LayoutBuilder

Source§

fn build(self) -> PluginValue

Convert this builder to a PluginValue

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 = 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.