pub type SideOffsets2D<T> = SideOffsets2D<T, UnknownUnit>;
Aliased Type§
struct SideOffsets2D<T> {
pub top: T,
pub right: T,
pub bottom: T,
pub left: T,
/* private fields */
}
Fields§
§top: T
§right: T
§bottom: T
§left: T
Implementations
Source§impl<T, U> SideOffsets2D<T, U>
impl<T, U> SideOffsets2D<T, U>
Sourcepub const fn new(top: T, right: T, bottom: T, left: T) -> Self
pub const fn new(top: T, right: T, bottom: T, left: T) -> Self
Constructor taking a scalar for each side.
Sides are specified in top-right-bottom-left order following CSS’s convention.
Sourcepub fn from_lengths(
top: Length<T, U>,
right: Length<T, U>,
bottom: Length<T, U>,
left: Length<T, U>,
) -> Self
pub fn from_lengths( top: Length<T, U>, right: Length<T, U>, bottom: Length<T, U>, left: Length<T, U>, ) -> Self
Constructor taking a typed Length for each side.
Sides are specified in top-right-bottom-left order following CSS’s convention.
Sourcepub fn from_vectors_outer(min: Vector2D<T, U>, max: Vector2D<T, U>) -> Selfwhere
T: Neg<Output = T>,
pub fn from_vectors_outer(min: Vector2D<T, U>, max: Vector2D<T, U>) -> Selfwhere
T: Neg<Output = T>,
Construct side offsets from min and a max vector offsets.
The outer rect of the resulting side offsets is equivalent to translating a rectangle’s upper-left corner with the min vector and translating the bottom-right corner with the max vector.
Sourcepub fn from_vectors_inner(min: Vector2D<T, U>, max: Vector2D<T, U>) -> Selfwhere
T: Neg<Output = T>,
pub fn from_vectors_inner(min: Vector2D<T, U>, max: Vector2D<T, U>) -> Selfwhere
T: Neg<Output = T>,
Construct side offsets from min and a max vector offsets.
The inner rect of the resulting side offsets is equivalent to translating a rectangle’s upper-left corner with the min vector and translating the bottom-right corner with the max vector.
Sourcepub fn new_all_same(all: T) -> Selfwhere
T: Copy,
pub fn new_all_same(all: T) -> Selfwhere
T: Copy,
Constructor setting the same value to all sides, taking a scalar value directly.
Sourcepub fn from_length_all_same(all: Length<T, U>) -> Selfwhere
T: Copy,
pub fn from_length_all_same(all: Length<T, U>) -> Selfwhere
T: Copy,
Constructor setting the same value to all sides, taking a typed Length.
pub fn horizontal(&self) -> T
pub fn vertical(&self) -> T
Trait Implementations
Source§impl<T, U> Add for SideOffsets2D<T, U>where
T: Add<T, Output = T>,
impl<T, U> Add for SideOffsets2D<T, U>where
T: Add<T, Output = T>,
Source§impl<T, U> AddAssign for SideOffsets2D<T, U>where
T: AddAssign<T>,
impl<T, U> AddAssign for SideOffsets2D<T, U>where
T: AddAssign<T>,
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moreSource§impl<T: Clone, U> Clone for SideOffsets2D<T, U>
impl<T: Clone, U> Clone for SideOffsets2D<T, U>
Source§impl<T: Debug, U> Debug for SideOffsets2D<T, U>
impl<T: Debug, U> Debug for SideOffsets2D<T, U>
Source§impl<T: Default, U> Default for SideOffsets2D<T, U>
impl<T: Default, U> Default for SideOffsets2D<T, U>
Source§impl<T: Copy + DivAssign, U> DivAssign<Scale<T, U, U>> for SideOffsets2D<T, U>
impl<T: Copy + DivAssign, U> DivAssign<Scale<T, U, U>> for SideOffsets2D<T, U>
Source§fn div_assign(&mut self, other: Scale<T, U, U>)
fn div_assign(&mut self, other: Scale<T, U, U>)
/=
operation. Read moreSource§impl<T: Copy + DivAssign, U> DivAssign<T> for SideOffsets2D<T, U>
impl<T: Copy + DivAssign, U> DivAssign<T> for SideOffsets2D<T, U>
Source§fn div_assign(&mut self, other: T)
fn div_assign(&mut self, other: T)
/=
operation. Read moreSource§impl<T, U> Hash for SideOffsets2D<T, U>where
T: Hash,
impl<T, U> Hash for SideOffsets2D<T, U>where
T: Hash,
Source§impl<T: Copy + MulAssign, U> MulAssign<Scale<T, U, U>> for SideOffsets2D<T, U>
impl<T: Copy + MulAssign, U> MulAssign<Scale<T, U, U>> for SideOffsets2D<T, U>
Source§fn mul_assign(&mut self, other: Scale<T, U, U>)
fn mul_assign(&mut self, other: Scale<T, U, U>)
*=
operation. Read moreSource§impl<T: Copy + MulAssign, U> MulAssign<T> for SideOffsets2D<T, U>
impl<T: Copy + MulAssign, U> MulAssign<T> for SideOffsets2D<T, U>
Source§fn mul_assign(&mut self, other: T)
fn mul_assign(&mut self, other: T)
*=
operation. Read moreSource§impl<T, U> Neg for SideOffsets2D<T, U>where
T: Neg<Output = T>,
impl<T, U> Neg for SideOffsets2D<T, U>where
T: Neg<Output = T>,
Source§impl<T, U> PartialEq for SideOffsets2D<T, U>where
T: PartialEq,
impl<T, U> PartialEq for SideOffsets2D<T, U>where
T: PartialEq,
Source§impl<T, U> Sub for SideOffsets2D<T, U>where
T: Sub<T, Output = T>,
impl<T, U> Sub for SideOffsets2D<T, U>where
T: Sub<T, Output = T>,
Source§impl<T, U> SubAssign for SideOffsets2D<T, U>where
T: SubAssign<T>,
impl<T, U> SubAssign for SideOffsets2D<T, U>where
T: SubAssign<T>,
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
-=
operation. Read more