Struct css_style::style::Style [−][src]
pub struct Style { /* fields omitted */ }
Expand description
This is the main struct used to build and manipulate css properties, it provieds many methods to do that.
use css_style::{Style, color, unit::{ms, px}};
Style::default()
.and_transition(|conf| {
conf
.insert("opacity", |conf| conf.duration(ms(150.)).ease())
.insert("transform", |conf| conf.duration(ms(150.)).ease())
.insert("visibility", |conf| conf.duration(ms(150.)).ease())
})
.and_position(|conf| conf.absolute())
.and_background(|conf| conf.color(color::named::WHITE))
.and_border(|conf| {
conf.none()
.width(px(0))
.radius(px(4))
})
.and_padding(|conf| conf.x(px(4)).y(px(2)))
.and_margin(|conf| conf.top(px(2)))
.insert("box-shadow", "0 2px 8px rgba(0, 35, 11, 0.15)");
Implementations
Insert a new css key value pair, or overwrite an existing one.
Same as insert
but take Option
Merge two style
Same as merge
but take Option
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
pub fn align_content(self, val: impl Into<AlignContent>) -> Self where
AlignContent: StyleUpdater,
pub fn align_content(self, val: impl Into<AlignContent>) -> Self where
AlignContent: StyleUpdater,
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
pub fn justify_content(self, val: impl Into<JustifyContent>) -> Self where
JustifyContent: StyleUpdater,
pub fn justify_content(self, val: impl Into<JustifyContent>) -> Self where
JustifyContent: StyleUpdater,
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
pub fn justify_self(self, val: impl Into<JustifySelf>) -> Self where
JustifySelf: StyleUpdater,
pub fn justify_self(self, val: impl Into<JustifySelf>) -> Self where
JustifySelf: StyleUpdater,
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
pub fn flex_direction(self, val: impl Into<FlexDirection>) -> Self where
FlexDirection: StyleUpdater,
pub fn flex_direction(self, val: impl Into<FlexDirection>) -> Self where
FlexDirection: StyleUpdater,
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
pub fn and_background(self, val: impl FnOnce(Background) -> Background) -> Self where
Background: Default + StyleUpdater,
pub fn and_background(self, val: impl FnOnce(Background) -> Background) -> Self where
Background: Default + StyleUpdater,
Setter for $prop_ty
that takes a closure which returns $prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
pub fn and_border(self, val: impl FnOnce(Border) -> Border) -> Self where
Border: Default + StyleUpdater,
pub fn and_border(self, val: impl FnOnce(Border) -> Border) -> Self where
Border: Default + StyleUpdater,
Setter for $prop_ty
that takes a closure which returns $prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
pub fn and_margin(self, val: impl FnOnce(Margin) -> Margin) -> Self where
Margin: Default + StyleUpdater,
pub fn and_margin(self, val: impl FnOnce(Margin) -> Margin) -> Self where
Margin: Default + StyleUpdater,
Setter for $prop_ty
that takes a closure which returns $prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
pub fn and_padding(self, val: impl FnOnce(Padding) -> Padding) -> Self where
Padding: Default + StyleUpdater,
pub fn and_padding(self, val: impl FnOnce(Padding) -> Padding) -> Self where
Padding: Default + StyleUpdater,
Setter for $prop_ty
that takes a closure which returns $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
that takes a closure which returns $prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
pub fn and_transition(self, val: impl FnOnce(Transition) -> Transition) -> Self where
Transition: Default + StyleUpdater,
pub fn and_transition(self, val: impl FnOnce(Transition) -> Transition) -> Self where
Transition: Default + StyleUpdater,
Setter for $prop_ty
that takes a closure which returns $prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
pub fn and_box_shadow(self, val: impl FnOnce(BoxShadow) -> BoxShadow) -> Self where
BoxShadow: Default + StyleUpdater,
pub fn and_box_shadow(self, val: impl FnOnce(BoxShadow) -> BoxShadow) -> Self where
BoxShadow: Default + StyleUpdater,
Setter for $prop_ty
that takes a closure which returns $prop_ty
Setter for $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
pub fn and_position(self, val: impl FnOnce(Position) -> Position) -> Self where
Position: Default + StyleUpdater,
pub fn and_position(self, val: impl FnOnce(Position) -> Position) -> Self where
Position: Default + StyleUpdater,
Setter for $prop_ty
that takes a closure which returns $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Setter for $prop_ty
that takes a closure which returns $prop_ty
Setter for $prop_ty
that takes Option<$prop_ty
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Style
impl UnwindSafe for Style
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
Mutably borrows from an owned value. Read more
Convert into T with values clamped to the color defined bounds Read more
Convert into T. The resulting color might be invalid in its color space Read more
Convert into T, returning ok if the color is inside of its defined
range, otherwise an OutOfBounds
error is returned which contains
the unclamped color. Read more