#[repr(C)]pub struct SideOffsets2D<T, U> {
pub top: T,
pub right: T,
pub bottom: T,
pub left: T,
/* private fields */
}
Expand description
A group of 2D side offsets, which correspond to top/right/bottom/left for borders, padding, and margins in CSS, optionally tagged with a unit.
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: 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<'de, T, U> Deserialize<'de> for SideOffsets2D<T, U>where
T: Deserialize<'de>,
impl<'de, T, U> Deserialize<'de> for SideOffsets2D<T, U>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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> PartialEq for SideOffsets2D<T, U>where
T: PartialEq,
impl<T, U> PartialEq for SideOffsets2D<T, U>where
T: PartialEq,
Source§impl<T, U> Serialize for SideOffsets2D<T, U>where
T: Serialize,
impl<T, U> Serialize for SideOffsets2D<T, U>where
T: Serialize,
impl<T: Copy, U> Copy for SideOffsets2D<T, U>
impl<T, U> Eq for SideOffsets2D<T, U>where
T: Eq,
Auto Trait Implementations§
impl<T, U> Freeze for SideOffsets2D<T, U>where
T: Freeze,
impl<T, U> RefUnwindSafe for SideOffsets2D<T, U>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for SideOffsets2D<T, U>
impl<T, U> Sync for SideOffsets2D<T, U>
impl<T, U> Unpin for SideOffsets2D<T, U>
impl<T, U> UnwindSafe for SideOffsets2D<T, U>where
T: UnwindSafe,
U: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)