pub struct Padding {
pub top: f32,
pub right: f32,
pub bottom: f32,
pub left: f32,
}
Expand description
An amount of space to pad for each side of a box
You can leverage the From
trait to build Padding
conveniently:
let padding = Padding::from(20); // 20px on all sides
let padding = Padding::from([10, 20]); // top/bottom, left/right
Normally, the padding
method of a widget will ask for an Into<Padding>
,
so you can easily write:
impl Widget {
pub fn padding(mut self, padding: impl Into<Padding>) -> Self {
// ...
self
}
}
let widget = Widget::new().padding(20); // 20px on all sides
let widget = Widget::new().padding([10, 20]); // top/bottom, left/right
Fields§
§top: f32
Top padding
right: f32
Right padding
bottom: f32
Bottom padding
left: f32
Left padding
Implementations§
Trait Implementations§
impl Copy for Padding
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.