pub struct EdgeInsets {
pub left: f32,
pub top: f32,
pub right: f32,
pub bottom: f32,
}Expand description
Padding values for each edge of a rectangle.
Fields§
§left: f32Inset on the left edge, in logical pixels.
top: f32Inset on the top edge, in logical pixels.
right: f32Inset on the right edge, in logical pixels.
bottom: f32Inset on the bottom edge, in logical pixels.
Implementations§
Source§impl EdgeInsets
impl EdgeInsets
Sourcepub fn uniform(all: f32) -> EdgeInsets
pub fn uniform(all: f32) -> EdgeInsets
Creates insets with all on every edge.
Sourcepub fn horizontal(horizontal: f32) -> EdgeInsets
pub fn horizontal(horizontal: f32) -> EdgeInsets
Creates insets with horizontal on the left and right and 0.0 on the top and bottom.
Sourcepub fn vertical(vertical: f32) -> EdgeInsets
pub fn vertical(vertical: f32) -> EdgeInsets
Creates insets with vertical on the top and bottom and 0.0 on the left and right.
Sourcepub fn symmetric(horizontal: f32, vertical: f32) -> EdgeInsets
pub fn symmetric(horizontal: f32, vertical: f32) -> EdgeInsets
Creates insets with horizontal on the left and right and vertical on the top and bottom.
Sourcepub fn from_components(
left: f32,
top: f32,
right: f32,
bottom: f32,
) -> EdgeInsets
pub fn from_components( left: f32, top: f32, right: f32, bottom: f32, ) -> EdgeInsets
Creates insets from separate left, top, right and bottom values.
Sourcepub fn horizontal_sum(&self) -> f32
pub fn horizontal_sum(&self) -> f32
The sum of the left and right insets.
Sourcepub fn vertical_sum(&self) -> f32
pub fn vertical_sum(&self) -> f32
The sum of the top and bottom insets.
Sourcepub fn inset_rect(&self, size: Size) -> Rect
pub fn inset_rect(&self, size: Size) -> Rect
The part of a size rect these insets leave, at the leading insets;
it never shrinks below zero.
Trait Implementations§
Source§impl AddAssign for EdgeInsets
impl AddAssign for EdgeInsets
Source§fn add_assign(&mut self, rhs: EdgeInsets)
fn add_assign(&mut self, rhs: EdgeInsets)
Performs the
+= operation. Read moreSource§impl Clone for EdgeInsets
impl Clone for EdgeInsets
Source§fn clone(&self) -> EdgeInsets
fn clone(&self) -> EdgeInsets
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for EdgeInsets
Source§impl Debug for EdgeInsets
impl Debug for EdgeInsets
Source§impl Default for EdgeInsets
impl Default for EdgeInsets
Source§fn default() -> EdgeInsets
fn default() -> EdgeInsets
Returns the “default value” for a type. Read more
Source§impl PartialEq for EdgeInsets
impl PartialEq for EdgeInsets
impl StructuralPartialEq for EdgeInsets
Auto Trait Implementations§
impl Freeze for EdgeInsets
impl RefUnwindSafe for EdgeInsets
impl Send for EdgeInsets
impl Sync for EdgeInsets
impl Unpin for EdgeInsets
impl UnsafeUnpin for EdgeInsets
impl UnwindSafe for EdgeInsets
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> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more