Struct TypedSideOffsets2D

Source
#[repr(C)]
pub struct TypedSideOffsets2D<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/left/bottom/right 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> TypedSideOffsets2D<T, U>
where T: Copy,

Source

pub fn new(top: T, right: T, bottom: T, left: T) -> TypedSideOffsets2D<T, U>

Constructor taking a scalar for each side.

Source

pub fn from_lengths( top: Length<T, U>, right: Length<T, U>, bottom: Length<T, U>, left: Length<T, U>, ) -> TypedSideOffsets2D<T, U>

Constructor taking a typed Length for each side.

Source

pub fn top_typed(&self) -> Length<T, U>

Access self.top as a typed Length instead of a scalar value.

Source

pub fn right_typed(&self) -> Length<T, U>

Access self.right as a typed Length instead of a scalar value.

Source

pub fn bottom_typed(&self) -> Length<T, U>

Access self.bottom as a typed Length instead of a scalar value.

Source

pub fn left_typed(&self) -> Length<T, U>

Access self.left as a typed Length instead of a scalar value.

Source

pub fn new_all_same(all: T) -> TypedSideOffsets2D<T, U>

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

Source

pub fn from_length_all_same(all: Length<T, U>) -> TypedSideOffsets2D<T, U>

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

Source§

impl<T, U> TypedSideOffsets2D<T, U>
where T: Add<Output = T> + Copy,

Source

pub fn horizontal(&self) -> T

Source

pub fn vertical(&self) -> T

Source

pub fn horizontal_typed(&self) -> Length<T, U>

Source

pub fn vertical_typed(&self) -> Length<T, U>

Source§

impl<T, U> TypedSideOffsets2D<T, U>
where T: Copy + Zero,

Source

pub fn zero() -> TypedSideOffsets2D<T, U>

Constructor, setting all sides to zero.

Trait Implementations§

Source§

impl<T, U> Add for TypedSideOffsets2D<T, U>
where T: Copy + Add<Output = T>,

Source§

type Output = TypedSideOffsets2D<T, U>

The resulting type after applying the + operator.
Source§

fn add(self, other: TypedSideOffsets2D<T, U>) -> TypedSideOffsets2D<T, U>

Performs the + operation. Read more
Source§

impl<T, U> Clone for TypedSideOffsets2D<T, U>
where T: Clone,

Source§

fn clone(&self) -> TypedSideOffsets2D<T, U>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, U> Debug for TypedSideOffsets2D<T, U>
where T: Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T, U> Default for TypedSideOffsets2D<T, U>
where T: Default,

Source§

fn default() -> TypedSideOffsets2D<T, U>

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

impl<T, U> Hash for TypedSideOffsets2D<T, U>
where T: Hash,

Source§

fn hash<H>(&self, h: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

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

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

impl<T, U> PartialEq for TypedSideOffsets2D<T, U>
where T: PartialEq,

Source§

fn eq(&self, other: &TypedSideOffsets2D<T, U>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, U> Copy for TypedSideOffsets2D<T, U>
where T: Copy,

Source§

impl<T, U> Eq for TypedSideOffsets2D<T, U>
where T: Eq,

Auto Trait Implementations§

§

impl<T, U> Freeze for TypedSideOffsets2D<T, U>
where T: Freeze,

§

impl<T, U> RefUnwindSafe for TypedSideOffsets2D<T, U>

§

impl<T, U> Send for TypedSideOffsets2D<T, U>
where T: Send, U: Send,

§

impl<T, U> Sync for TypedSideOffsets2D<T, U>
where T: Sync, U: Sync,

§

impl<T, U> Unpin for TypedSideOffsets2D<T, U>
where T: Unpin, U: Unpin,

§

impl<T, U> UnwindSafe for TypedSideOffsets2D<T, U>
where T: UnwindSafe, U: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.