Struct savory_style::style::Style [−][src]
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]
self,
key: impl Into<Cow<'static, str>>,
value: impl ToString
) -> Self
pub fn try_push_custom(
self,
key: impl Into<Cow<'static, str>>,
value: Option<impl ToString>
) -> Self
[src]
self,
key: impl Into<Cow<'static, str>>,
value: Option<impl ToString>
) -> Self
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]
Opacity: UpdateStyleValues,
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]
Gap: UpdateStyleValues,
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]
AlignContent: UpdateStyleValues,
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]
AlignItems: UpdateStyleValues,
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]
JustifyContent: UpdateStyleValues,
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]
JustifySelf: UpdateStyleValues,
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]
AlignSelf: UpdateStyleValues,
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]
FlexWrap: UpdateStyleValues,
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]
FlexBasis: UpdateStyleValues,
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]
FlexDirection: UpdateStyleValues,
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]
FlexOrder: UpdateStyleValues,
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]
FlexGrow: UpdateStyleValues,
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]
FlexShrink: UpdateStyleValues,
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]
Display: UpdateStyleValues,
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]
Visibility: UpdateStyleValues,
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]
Cursor: UpdateStyleValues,
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]
Background: UpdateStyleValues,
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]
Background: Default + UpdateStyleValues,
pub fn border(self, val: impl Into<Border>) -> Self where
Border: UpdateStyleValues,
[src]
Border: UpdateStyleValues,
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]
Border: Default + UpdateStyleValues,
pub fn margin(self, val: impl Into<Margin>) -> Self where
Margin: UpdateStyleValues,
[src]
Margin: UpdateStyleValues,
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]
Margin: Default + UpdateStyleValues,
pub fn padding(self, val: impl Into<Padding>) -> Self where
Padding: UpdateStyleValues,
[src]
Padding: UpdateStyleValues,
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]
Padding: Default + UpdateStyleValues,
pub fn size(self, val: impl Into<Size>) -> Self where
Size: UpdateStyleValues,
[src]
Size: UpdateStyleValues,
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]
Size: Default + UpdateStyleValues,
pub fn transition(self, val: impl Into<Transition>) -> Self where
Transition: UpdateStyleValues,
[src]
Transition: UpdateStyleValues,
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]
Transition: Default + UpdateStyleValues,
pub fn box_shadow(self, val: impl Into<BoxShadow>) -> Self where
BoxShadow: UpdateStyleValues,
[src]
BoxShadow: UpdateStyleValues,
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]
BoxShadow: Default + UpdateStyleValues,
pub fn position(self, val: impl Into<Position>) -> Self where
Position: UpdateStyleValues,
[src]
Position: UpdateStyleValues,
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]
Position: Default + UpdateStyleValues,
pub fn text(self, val: impl Into<Text>) -> Self where
Text: UpdateStyleValues,
[src]
Text: UpdateStyleValues,
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]
Text: Default + UpdateStyleValues,
pub fn font(self, val: impl Into<Font>) -> Self where
Font: UpdateStyleValues,
[src]
Font: UpdateStyleValues,
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]
Font: Default + UpdateStyleValues,
Trait Implementations
impl Clone for Style
[src]
impl Debug for Style
[src]
impl DeclarativeConfig for Style
[src]
pub fn config(self, block: impl FnOnce(Self) -> Self) -> Self
[src]
pub fn config_if(
self,
condition: bool,
block: impl FnOnce(Self) -> Self
) -> Self
[src]
self,
condition: bool,
block: impl FnOnce(Self) -> Self
) -> Self
pub fn config_if_else(
self,
condition: bool,
block: impl FnOnce(Self) -> Self,
else_block: impl FnOnce(Self) -> Self
) -> Self
[src]
self,
condition: bool,
block: impl FnOnce(Self) -> Self,
else_block: impl FnOnce(Self) -> Self
) -> Self
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]
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
pub fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
pub fn adapt_into(self) -> D
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> ConvertInto<U> for T where
U: ConvertFrom<T>,
[src]
U: ConvertFrom<T>,
pub fn convert_into(self) -> U
[src]
pub fn convert_unclamped_into(self) -> U
[src]
pub fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,