Struct euclid::SideOffsets2D
source · [−]#[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
sourceimpl<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>) -> Self where
T: Neg<Output = T>,
pub fn from_vectors_outer(min: Vector2D<T, U>, max: Vector2D<T, U>) -> Self where
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>) -> Self where
T: Neg<Output = T>,
pub fn from_vectors_inner(min: Vector2D<T, U>, max: Vector2D<T, U>) -> Self where
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 is_zero(&self) -> bool where
T: Zero + PartialEq,
pub fn is_zero(&self) -> bool where
T: Zero + PartialEq,
Returns true
if all side offsets are zero.
sourcepub fn new_all_same(all: T) -> Self where
T: Copy,
pub fn new_all_same(all: T) -> Self where
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>) -> Self where
T: Copy,
pub fn from_length_all_same(all: Length<T, U>) -> Self where
T: Copy,
Constructor setting the same value to all sides, taking a typed Length.
pub fn horizontal(&self) -> T where
T: Copy + Add<T, Output = T>,
pub fn vertical(&self) -> T where
T: Copy + Add<T, Output = T>,
Trait Implementations
sourceimpl<T, U> Add<SideOffsets2D<T, U>> for SideOffsets2D<T, U> where
T: Add<T, Output = T>,
impl<T, U> Add<SideOffsets2D<T, U>> for SideOffsets2D<T, U> where
T: Add<T, Output = T>,
sourceimpl<T, U> AddAssign<SideOffsets2D<T, U>> for SideOffsets2D<T, U> where
T: AddAssign<T>,
impl<T, U> AddAssign<SideOffsets2D<T, U>> for SideOffsets2D<T, U> where
T: AddAssign<T>,
sourcefn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the +=
operation. Read more
sourceimpl<T: Clone, U> Clone for SideOffsets2D<T, U>
impl<T: Clone, U> Clone for SideOffsets2D<T, U>
sourceimpl<T: Debug, U> Debug for SideOffsets2D<T, U>
impl<T: Debug, U> Debug for SideOffsets2D<T, U>
sourceimpl<T: Default, U> Default for SideOffsets2D<T, U>
impl<T: Default, U> Default for SideOffsets2D<T, U>
sourceimpl<T: Copy + Div, U> Div<T> for SideOffsets2D<T, U>
impl<T: Copy + Div, U> Div<T> for SideOffsets2D<T, U>
sourceimpl<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>
sourcefn div_assign(&mut self, other: Scale<T, U, U>)
fn div_assign(&mut self, other: Scale<T, U, U>)
Performs the /=
operation. Read more
sourceimpl<T: Copy + DivAssign, U> DivAssign<T> for SideOffsets2D<T, U>
impl<T: Copy + DivAssign, U> DivAssign<T> for SideOffsets2D<T, U>
sourcefn div_assign(&mut self, other: T)
fn div_assign(&mut self, other: T)
Performs the /=
operation. Read more
sourceimpl<T, U> Hash for SideOffsets2D<T, U> where
T: Hash,
impl<T, U> Hash for SideOffsets2D<T, U> where
T: Hash,
sourceimpl<T: Copy + Mul, U> Mul<T> for SideOffsets2D<T, U>
impl<T: Copy + Mul, U> Mul<T> for SideOffsets2D<T, U>
sourceimpl<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>
sourcefn mul_assign(&mut self, other: Scale<T, U, U>)
fn mul_assign(&mut self, other: Scale<T, U, U>)
Performs the *=
operation. Read more
sourceimpl<T: Copy + MulAssign, U> MulAssign<T> for SideOffsets2D<T, U>
impl<T: Copy + MulAssign, U> MulAssign<T> for SideOffsets2D<T, U>
sourcefn mul_assign(&mut self, other: T)
fn mul_assign(&mut self, other: T)
Performs the *=
operation. Read more
sourceimpl<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>,
sourceimpl<T, U> PartialEq<SideOffsets2D<T, U>> for SideOffsets2D<T, U> where
T: PartialEq,
impl<T, U> PartialEq<SideOffsets2D<T, U>> for SideOffsets2D<T, U> where
T: PartialEq,
sourceimpl<T, U> Sub<SideOffsets2D<T, U>> for SideOffsets2D<T, U> where
T: Sub<T, Output = T>,
impl<T, U> Sub<SideOffsets2D<T, U>> for SideOffsets2D<T, U> where
T: Sub<T, Output = T>,
sourceimpl<T, U> SubAssign<SideOffsets2D<T, U>> for SideOffsets2D<T, U> where
T: SubAssign<T>,
impl<T, U> SubAssign<SideOffsets2D<T, U>> for SideOffsets2D<T, U> where
T: SubAssign<T>,
sourcefn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the -=
operation. Read more
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> RefUnwindSafe for SideOffsets2D<T, U> where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for SideOffsets2D<T, U> where
T: Send,
U: Send,
impl<T, U> Sync for SideOffsets2D<T, U> where
T: Sync,
U: Sync,
impl<T, U> Unpin for SideOffsets2D<T, U> where
T: Unpin,
U: Unpin,
impl<T, U> UnwindSafe for SideOffsets2D<T, U> where
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more