pub struct Margin {
pub left: i8,
pub right: i8,
pub top: i8,
pub bottom: i8,
}Expand description
A value for all four sides of a rectangle, often used to express padding or spacing.
Can be added and subtracted to/from Rects.
Negative margins are possible, but may produce weird behavior. Use with care.
All values are stored as i8 to keep the size of Margin small.
If you want floats, use crate::MarginF32 instead.
Fields§
§left: i8§right: i8§top: i8§bottom: i8Implementations§
Trait Implementations§
Source§impl AddAssign<Margin> for Rect
Rect += Margin
impl AddAssign<Margin> for Rect
Rect += Margin
Source§fn add_assign(&mut self, margin: Margin)
fn add_assign(&mut self, margin: Margin)
Performs the
+= operation. Read moreSource§impl AddAssign<i8> for Margin
Margin += i8
impl AddAssign<i8> for Margin
Margin += i8
Source§fn add_assign(&mut self, v: i8)
fn add_assign(&mut self, v: i8)
Performs the
+= operation. Read moreimpl Copy for Margin
Source§impl DivAssign<f32> for Margin
Margin /= f32
impl DivAssign<f32> for Margin
Margin /= f32
Source§fn div_assign(&mut self, v: f32)
fn div_assign(&mut self, v: f32)
Performs the
/= operation. Read moreimpl Eq for Margin
Source§impl MulAssign<f32> for Margin
Margin *= f32
impl MulAssign<f32> for Margin
Margin *= f32
Source§fn mul_assign(&mut self, v: f32)
fn mul_assign(&mut self, v: f32)
Performs the
*= operation. Read moreimpl StructuralPartialEq for Margin
Source§impl SubAssign<Margin> for Rect
Rect -= Margin
impl SubAssign<Margin> for Rect
Rect -= Margin
Source§fn sub_assign(&mut self, margin: Margin)
fn sub_assign(&mut self, margin: Margin)
Performs the
-= operation. Read moreAuto Trait Implementations§
impl Freeze for Margin
impl RefUnwindSafe for Margin
impl Send for Margin
impl Sync for Margin
impl Unpin for Margin
impl UnsafeUnpin for Margin
impl UnwindSafe for Margin
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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