Struct euclid::SideOffsets2D[][src]

#[repr(C)]
pub struct SideOffsets2D<T, U> { pub top: T, pub right: T, pub bottom: T, pub left: T, // some fields omitted }
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: Tright: Tbottom: Tleft: T

Implementations

impl<T, U> SideOffsets2D<T, U>[src]

pub const fn new(top: T, right: T, bottom: T, left: T) -> Self[src]

Constructor taking a scalar for each side.

Sides are specified in top-right-bottom-left order following CSS’s convention.

pub fn from_lengths(
    top: Length<T, U>,
    right: Length<T, U>,
    bottom: Length<T, U>,
    left: Length<T, U>
) -> Self
[src]

Constructor taking a typed Length for each side.

Sides are specified in top-right-bottom-left order following CSS’s convention.

pub fn from_vectors_outer(min: Vector2D<T, U>, max: Vector2D<T, U>) -> Self where
    T: Neg<Output = T>, 
[src]

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.

pub fn from_vectors_inner(min: Vector2D<T, U>, max: Vector2D<T, U>) -> Self where
    T: Neg<Output = T>, 
[src]

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.

pub fn zero() -> Self where
    T: Zero
[src]

Constructor, setting all sides to zero.

pub fn is_zero(&self) -> bool where
    T: Zero + PartialEq
[src]

Returns true if all side offsets are zero.

pub fn new_all_same(all: T) -> Self where
    T: Copy
[src]

Constructor setting the same value to all sides, taking a scalar value directly.

pub fn from_length_all_same(all: Length<T, U>) -> Self where
    T: Copy
[src]

Constructor setting the same value to all sides, taking a typed Length.

pub fn horizontal(&self) -> T where
    T: Copy + Add<T, Output = T>, 
[src]

pub fn vertical(&self) -> T where
    T: Copy + Add<T, Output = T>, 
[src]

Trait Implementations

impl<T, U> Add<SideOffsets2D<T, U>> for SideOffsets2D<T, U> where
    T: Add<T, Output = T>, 
[src]

type Output = Self

The resulting type after applying the + operator.

fn add(self, other: Self) -> Self[src]

Performs the + operation. Read more

impl<T: Clone, U> Clone for SideOffsets2D<T, U>[src]

fn clone(&self) -> Self[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Debug, U> Debug for SideOffsets2D<T, U>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<T: Default, U> Default for SideOffsets2D<T, U>[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl<T: Copy + Div, U1, U2> Div<Scale<T, U1, U2>> for SideOffsets2D<T, U2>[src]

type Output = SideOffsets2D<T::Output, U1>

The resulting type after applying the / operator.

fn div(self, scale: Scale<T, U1, U2>) -> Self::Output[src]

Performs the / operation. Read more

impl<T: Copy + Div, U> Div<T> for SideOffsets2D<T, U>[src]

type Output = SideOffsets2D<T::Output, U>

The resulting type after applying the / operator.

fn div(self, scale: T) -> Self::Output[src]

Performs the / operation. Read more

impl<T: Copy + DivAssign, U> DivAssign<Scale<T, U, U>> for SideOffsets2D<T, U>[src]

fn div_assign(&mut self, other: Scale<T, U, U>)[src]

Performs the /= operation. Read more

impl<T: Copy + DivAssign, U> DivAssign<T> for SideOffsets2D<T, U>[src]

fn div_assign(&mut self, other: T)[src]

Performs the /= operation. Read more

impl<T, U> Hash for SideOffsets2D<T, U> where
    T: Hash
[src]

fn hash<H: Hasher>(&self, h: &mut H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl<T: Copy + Mul, U1, U2> Mul<Scale<T, U1, U2>> for SideOffsets2D<T, U1>[src]

type Output = SideOffsets2D<T::Output, U2>

The resulting type after applying the * operator.

fn mul(self, scale: Scale<T, U1, U2>) -> Self::Output[src]

Performs the * operation. Read more

impl<T: Copy + Mul, U> Mul<T> for SideOffsets2D<T, U>[src]

type Output = SideOffsets2D<T::Output, U>

The resulting type after applying the * operator.

fn mul(self, scale: T) -> Self::Output[src]

Performs the * operation. Read more

impl<T: Copy + MulAssign, U> MulAssign<Scale<T, U, U>> for SideOffsets2D<T, U>[src]

fn mul_assign(&mut self, other: Scale<T, U, U>)[src]

Performs the *= operation. Read more

impl<T: Copy + MulAssign, U> MulAssign<T> for SideOffsets2D<T, U>[src]

fn mul_assign(&mut self, other: T)[src]

Performs the *= operation. Read more

impl<T, U> PartialEq<SideOffsets2D<T, U>> for SideOffsets2D<T, U> where
    T: PartialEq
[src]

fn eq(&self, other: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<T: Copy, U> Copy for SideOffsets2D<T, U>[src]

impl<T, U> Eq for SideOffsets2D<T, U> where
    T: Eq
[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.