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: Copy, U> TypedSideOffsets2D<T, U>

Source

pub fn new(top: T, right: T, bottom: T, left: T) -> Self

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>, ) -> Self

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) -> Self

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

Source

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

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

Source§

impl<T, U> TypedSideOffsets2D<T, U>
where T: Add<T, 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: Copy + Zero, U> TypedSideOffsets2D<T, U>

Source

pub fn zero() -> Self

Constructor, setting all sides to zero.

Trait Implementations§

Source§

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

Source§

type Output = TypedSideOffsets2D<T, U>

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

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

Source§

fn clone(&self) -> Self

Returns a duplicate 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: Debug, U> Debug for TypedSideOffsets2D<T, U>

Source§

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

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

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

Source§

fn default() -> Self

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

impl<'de, T, U> Deserialize<'de> for TypedSideOffsets2D<T, U>
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

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

Source§

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

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: &Self) -> 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> Serialize for TypedSideOffsets2D<T, U>
where T: Serialize,

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,