1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
pub use super::box_align::{AlignContent, AlignItems, AlignSelf, JustifyContent}; use crate::{css, unit::*, Style, StyleUpdater}; #[derive(Clone, Debug, PartialEq, Display, From)] pub enum Basis { #[from] Content(css::Content), #[from] Auto(css::Auto), #[from] Inherit(css::Inherit), #[from] Length(Length), #[from(forward)] Percent(Percent), } impl StyleUpdater for Basis { fn update_style(self, style: Style) -> Style { style.insert("flex-basis", self) } } #[derive(Clone, Debug, Copy, PartialEq, Eq, Display, From)] pub enum Direction { #[from] Row(css::Row), #[from] RowReverse(css::RowReverse), #[from] Column(css::Column), #[from] ColumnReverse(css::ColumnReverse), } impl StyleUpdater for Direction { fn update_style(self, style: Style) -> Style { style.insert("flex-direction", self) } } #[derive(Clone, Debug, Copy, PartialEq, Eq, Display, From)] pub enum Wrap { #[from] Wrap(css::Wrap), #[from] Nowrap(css::Nowrap), #[from] WrapReverse(css::WrapReverse), } impl StyleUpdater for Wrap { fn update_style(self, style: Style) -> Style { style.insert("flex-wrap", self) } } #[derive(Clone, Debug, Copy, PartialEq, Eq, Display, From)] pub struct Order(i32); impl StyleUpdater for Order { fn update_style(self, style: Style) -> Style { style.insert("order", self.0) } } #[derive(Clone, Debug, Copy, PartialEq, Display, From)] pub struct Grow(f32); impl From<u16> for Grow { fn from(source: u16) -> Self { Grow(source.into()) } } impl StyleUpdater for Grow { fn update_style(self, style: Style) -> Style { style.insert("flex-grow", self.0) } } #[derive(Clone, Debug, Copy, PartialEq, Display, From)] pub struct Shrink(f32); impl StyleUpdater for Shrink { fn update_style(self, style: Style) -> Style { style.insert("flex-shrink", self.0) } }