pub struct Padding {
pub top: f32,
pub right: f32,
pub bottom: f32,
pub left: f32,
}Expand description
Padding specification (top, right, bottom, left)
Fields§
§top: f32§right: f32§bottom: f32§left: f32Implementations§
Source§impl Padding
impl Padding
Sourcepub fn parse(s: &str) -> Result<Self, String>
pub fn parse(s: &str) -> Result<Self, String>
Parse padding from string
§Formats
"<all>": All sides (e.g., “10”)"<v> <h>": Vertical and horizontal (e.g., “10 20”)"<t> <r> <b> <l>": Individual sides (e.g., “10 20 30 40”)
§Examples
use dampen_core::ir::layout::Padding;
assert_eq!(Padding::parse("10"), Ok(Padding { top: 10.0, right: 10.0, bottom: 10.0, left: 10.0 }));
assert_eq!(Padding::parse("10 20"), Ok(Padding { top: 10.0, right: 20.0, bottom: 10.0, left: 20.0 }));
assert_eq!(Padding::parse("10 20 30 40"), Ok(Padding { top: 10.0, right: 20.0, bottom: 30.0, left: 40.0 }));Trait Implementations§
Source§impl<'de> Deserialize<'de> for Padding
impl<'de> Deserialize<'de> for Padding
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Padding
Auto Trait Implementations§
impl Freeze for Padding
impl RefUnwindSafe for Padding
impl Send for Padding
impl Sync for Padding
impl Unpin for Padding
impl UnwindSafe for Padding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more