Struct savory_style::style::Style[][src]

pub struct Style { /* fields omitted */ }

This is the main struct used to build and manipulate css properties, it provieds many methods to do that.

use savory_style::{Style, Color, unit::{ms, px}, St};

Style::default()
    .and_transition(|conf| {
        conf
            .add("opacity", |conf| conf.duration(ms(150.)).ease())
            .add("transform", |conf| conf.duration(ms(150.)).ease())
            .add("visibility", |conf| conf.duration(ms(150.)).ease())
    })
    .and_position(|conf| conf.absolute())
    .and_background(|conf| conf.color(Color::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)))
    .push(St::BoxShadow, "0 2px 8px rgba(0, 35, 11, 0.15)");

Implementations

impl Style[src]

pub fn new() -> Self[src]

pub fn to_css(&self) -> Option<String>[src]

This method convert this style to html style value

pub fn push(self, key: impl Into<St>, value: impl ToString) -> Self[src]

Shortcut for self.others.add()

pub fn try_push(self, key: impl Into<St>, value: Option<impl ToString>) -> Self[src]

Shortcut for self.values.try_add()

pub fn push_custom(
    self,
    key: impl Into<Cow<'static, str>>,
    value: impl ToString
) -> Self
[src]

pub fn try_push_custom(
    self,
    key: impl Into<Cow<'static, str>>,
    value: Option<impl ToString>
) -> Self
[src]

pub fn merge(self, other: impl UpdateStyleValues) -> Self[src]

Shortcut for self.values.merge()

pub fn try_merge(self, other: Option<impl UpdateStyleValues>) -> Self[src]

Shortcut for self.values.try_merge()

pub fn opacity(self, val: impl Into<Opacity>) -> Self where
    Opacity: UpdateStyleValues
[src]

pub fn try_opacity(self, val: Option<impl Into<Opacity>>) -> Self[src]

pub fn gap(self, val: impl Into<Gap>) -> Self where
    Gap: UpdateStyleValues
[src]

pub fn try_gap(self, val: Option<impl Into<Gap>>) -> Self[src]

pub fn align_content(self, val: impl Into<AlignContent>) -> Self where
    AlignContent: UpdateStyleValues
[src]

pub fn try_align_content(self, val: Option<impl Into<AlignContent>>) -> Self[src]

pub fn align_items(self, val: impl Into<AlignItems>) -> Self where
    AlignItems: UpdateStyleValues
[src]

pub fn try_align_items(self, val: Option<impl Into<AlignItems>>) -> Self[src]

pub fn justify_content(self, val: impl Into<JustifyContent>) -> Self where
    JustifyContent: UpdateStyleValues
[src]

pub fn try_justify_content(self, val: Option<impl Into<JustifyContent>>) -> Self[src]

pub fn justify_self(self, val: impl Into<JustifySelf>) -> Self where
    JustifySelf: UpdateStyleValues
[src]

pub fn try_justify_self(self, val: Option<impl Into<JustifySelf>>) -> Self[src]

pub fn align_self(self, val: impl Into<AlignSelf>) -> Self where
    AlignSelf: UpdateStyleValues
[src]

pub fn try_align_self(self, val: Option<impl Into<AlignSelf>>) -> Self[src]

pub fn flex_wrap(self, val: impl Into<FlexWrap>) -> Self where
    FlexWrap: UpdateStyleValues
[src]

pub fn try_flex_wrap(self, val: Option<impl Into<FlexWrap>>) -> Self[src]

pub fn flex_basis(self, val: impl Into<FlexBasis>) -> Self where
    FlexBasis: UpdateStyleValues
[src]

pub fn try_flex_basis(self, val: Option<impl Into<FlexBasis>>) -> Self[src]

pub fn flex_direction(self, val: impl Into<FlexDirection>) -> Self where
    FlexDirection: UpdateStyleValues
[src]

pub fn try_flex_direction(self, val: Option<impl Into<FlexDirection>>) -> Self[src]

pub fn flex_order(self, val: impl Into<FlexOrder>) -> Self where
    FlexOrder: UpdateStyleValues
[src]

pub fn try_flex_order(self, val: Option<impl Into<FlexOrder>>) -> Self[src]

pub fn flex_grow(self, val: impl Into<FlexGrow>) -> Self where
    FlexGrow: UpdateStyleValues
[src]

pub fn try_flex_grow(self, val: Option<impl Into<FlexGrow>>) -> Self[src]

pub fn flex_shrink(self, val: impl Into<FlexShrink>) -> Self where
    FlexShrink: UpdateStyleValues
[src]

pub fn try_flex_shrink(self, val: Option<impl Into<FlexShrink>>) -> Self[src]

pub fn display(self, val: impl Into<Display>) -> Self where
    Display: UpdateStyleValues
[src]

pub fn try_display(self, val: Option<impl Into<Display>>) -> Self[src]

pub fn visibility(self, val: impl Into<Visibility>) -> Self where
    Visibility: UpdateStyleValues
[src]

pub fn try_visibility(self, val: Option<impl Into<Visibility>>) -> Self[src]

pub fn cursor(self, val: impl Into<Cursor>) -> Self where
    Cursor: UpdateStyleValues
[src]

pub fn try_cursor(self, val: Option<impl Into<Cursor>>) -> Self[src]

pub fn background(self, val: impl Into<Background>) -> Self where
    Background: UpdateStyleValues
[src]

pub fn try_background(self, val: Option<impl Into<Background>>) -> Self[src]

pub fn and_background(self, val: impl FnOnce(Background) -> Background) -> Self where
    Background: Default + UpdateStyleValues
[src]

pub fn border(self, val: impl Into<Border>) -> Self where
    Border: UpdateStyleValues
[src]

pub fn try_border(self, val: Option<impl Into<Border>>) -> Self[src]

pub fn and_border(self, val: impl FnOnce(Border) -> Border) -> Self where
    Border: Default + UpdateStyleValues
[src]

pub fn margin(self, val: impl Into<Margin>) -> Self where
    Margin: UpdateStyleValues
[src]

pub fn try_margin(self, val: Option<impl Into<Margin>>) -> Self[src]

pub fn and_margin(self, val: impl FnOnce(Margin) -> Margin) -> Self where
    Margin: Default + UpdateStyleValues
[src]

pub fn padding(self, val: impl Into<Padding>) -> Self where
    Padding: UpdateStyleValues
[src]

pub fn try_padding(self, val: Option<impl Into<Padding>>) -> Self[src]

pub fn and_padding(self, val: impl FnOnce(Padding) -> Padding) -> Self where
    Padding: Default + UpdateStyleValues
[src]

pub fn size(self, val: impl Into<Size>) -> Self where
    Size: UpdateStyleValues
[src]

pub fn try_size(self, val: Option<impl Into<Size>>) -> Self[src]

pub fn and_size(self, val: impl FnOnce(Size) -> Size) -> Self where
    Size: Default + UpdateStyleValues
[src]

pub fn transition(self, val: impl Into<Transition>) -> Self where
    Transition: UpdateStyleValues
[src]

pub fn try_transition(self, val: Option<impl Into<Transition>>) -> Self[src]

pub fn and_transition(self, val: impl FnOnce(Transition) -> Transition) -> Self where
    Transition: Default + UpdateStyleValues
[src]

pub fn box_shadow(self, val: impl Into<BoxShadow>) -> Self where
    BoxShadow: UpdateStyleValues
[src]

pub fn try_box_shadow(self, val: Option<impl Into<BoxShadow>>) -> Self[src]

pub fn and_box_shadow(self, val: impl FnOnce(BoxShadow) -> BoxShadow) -> Self where
    BoxShadow: Default + UpdateStyleValues
[src]

pub fn position(self, val: impl Into<Position>) -> Self where
    Position: UpdateStyleValues
[src]

pub fn try_position(self, val: Option<impl Into<Position>>) -> Self[src]

pub fn and_position(self, val: impl FnOnce(Position) -> Position) -> Self where
    Position: Default + UpdateStyleValues
[src]

pub fn text(self, val: impl Into<Text>) -> Self where
    Text: UpdateStyleValues
[src]

pub fn try_text(self, val: Option<impl Into<Text>>) -> Self[src]

pub fn and_text(self, val: impl FnOnce(Text) -> Text) -> Self where
    Text: Default + UpdateStyleValues
[src]

pub fn font(self, val: impl Into<Font>) -> Self where
    Font: UpdateStyleValues
[src]

pub fn try_font(self, val: Option<impl Into<Font>>) -> Self[src]

pub fn and_font(self, val: impl FnOnce(Font) -> Font) -> Self where
    Font: Default + UpdateStyleValues
[src]

Trait Implementations

impl Clone for Style[src]

impl Debug for Style[src]

impl DeclarativeConfig for Style[src]

impl Default for Style[src]

impl Display for Style[src]

impl From<Style> for Style[src]

impl PartialEq<Style> for Style[src]

impl StructuralPartialEq for Style[src]

impl<Msg> UpdateEl<Msg> for Style[src]

Auto Trait Implementations

impl RefUnwindSafe for Style

impl Send for Style

impl Sync for Style

impl Unpin for Style

impl UnwindSafe for Style

Blanket Implementations

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    T: Component + Float,
    D: AdaptFrom<S, Swp, Dwp, T>,
    Swp: WhitePoint,
    Dwp: WhitePoint
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,