pub struct BoxModel {
pub margin: EdgeInsets,
pub padding: EdgeInsets,
}Expand description
Composable margin + padding (also mirrored on super::LayoutStyle).
§Examples
use ailloli_ui_core::style::BoxModel;
assert_eq!(BoxModel::new().padding(8.0).padding.left, 8.0);Fields§
§margin: EdgeInsetsSpace outside the decorated widget border, in logical pixels.
padding: EdgeInsetsSpace between the border and content, in logical pixels.
Implementations§
Source§impl BoxModel
impl BoxModel
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates zero margin and zero padding.
§Examples
use ailloli_ui_core::style::BoxModel;
assert_eq!(BoxModel::new().margin.left, 0.0);Sourcepub fn with_padding(padding: EdgeInsets) -> Self
pub fn with_padding(padding: EdgeInsets) -> Self
Creates zero margin with the supplied per-edge padding.
§Examples
use ailloli_ui_core::EdgeInsets;
use ailloli_ui_core::style::BoxModel;
assert_eq!(BoxModel::with_padding(EdgeInsets::all(4.0)).padding.top, 4.0);Sourcepub fn with_margin(margin: EdgeInsets) -> Self
pub fn with_margin(margin: EdgeInsets) -> Self
Creates the supplied per-edge margin with zero padding.
§Examples
use ailloli_ui_core::EdgeInsets;
use ailloli_ui_core::style::BoxModel;
assert_eq!(BoxModel::with_margin(EdgeInsets::all(4.0)).margin.top, 4.0);Trait Implementations§
impl Copy for BoxModel
impl StructuralPartialEq for BoxModel
Auto Trait Implementations§
impl Freeze for BoxModel
impl RefUnwindSafe for BoxModel
impl Send for BoxModel
impl Sync for BoxModel
impl Unpin for BoxModel
impl UnwindSafe for BoxModel
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