#[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,
impl<T, U> TypedSideOffsets2D<T, U>where
T: Copy,
Sourcepub fn new(top: T, right: T, bottom: T, left: T) -> TypedSideOffsets2D<T, U>
pub fn new(top: T, right: T, bottom: T, left: T) -> TypedSideOffsets2D<T, U>
Constructor taking a scalar for each side.
Sourcepub fn from_lengths(
top: Length<T, U>,
right: Length<T, U>,
bottom: Length<T, U>,
left: Length<T, U>,
) -> TypedSideOffsets2D<T, U>
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.
Sourcepub fn top_typed(&self) -> Length<T, U>
pub fn top_typed(&self) -> Length<T, U>
Access self.top as a typed Length instead of a scalar value.
Sourcepub fn right_typed(&self) -> Length<T, U>
pub fn right_typed(&self) -> Length<T, U>
Access self.right as a typed Length instead of a scalar value.
Sourcepub fn bottom_typed(&self) -> Length<T, U>
pub fn bottom_typed(&self) -> Length<T, U>
Access self.bottom as a typed Length instead of a scalar value.
Sourcepub fn left_typed(&self) -> Length<T, U>
pub fn left_typed(&self) -> Length<T, U>
Access self.left as a typed Length instead of a scalar value.
Sourcepub fn new_all_same(all: T) -> TypedSideOffsets2D<T, U>
pub fn new_all_same(all: T) -> TypedSideOffsets2D<T, U>
Constructor setting the same value to all sides, taking a scalar value directly.
Sourcepub fn from_length_all_same(all: Length<T, U>) -> TypedSideOffsets2D<T, U>
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>
impl<T, U> TypedSideOffsets2D<T, U>
pub fn horizontal(&self) -> T
pub fn vertical(&self) -> T
pub fn horizontal_typed(&self) -> Length<T, U>
pub fn vertical_typed(&self) -> Length<T, U>
Source§impl<T, U> TypedSideOffsets2D<T, U>
impl<T, U> TypedSideOffsets2D<T, U>
Sourcepub fn zero() -> TypedSideOffsets2D<T, U>
pub fn zero() -> TypedSideOffsets2D<T, U>
Constructor, setting all sides to zero.
Trait Implementations§
Source§impl<T, U> Add for TypedSideOffsets2D<T, U>
impl<T, U> Add for TypedSideOffsets2D<T, U>
Source§type Output = TypedSideOffsets2D<T, U>
type Output = TypedSideOffsets2D<T, U>
The resulting type after applying the
+
operator.Source§fn add(self, other: TypedSideOffsets2D<T, U>) -> TypedSideOffsets2D<T, U>
fn add(self, other: TypedSideOffsets2D<T, U>) -> TypedSideOffsets2D<T, U>
Performs the
+
operation. Read moreSource§impl<T, U> Clone for TypedSideOffsets2D<T, U>where
T: Clone,
impl<T, U> Clone for TypedSideOffsets2D<T, U>where
T: Clone,
Source§fn clone(&self) -> TypedSideOffsets2D<T, U>
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T, U> Debug for TypedSideOffsets2D<T, U>where
T: Debug,
impl<T, U> Debug for TypedSideOffsets2D<T, U>where
T: Debug,
Source§impl<T, U> Default for TypedSideOffsets2D<T, U>where
T: Default,
impl<T, U> Default for TypedSideOffsets2D<T, U>where
T: Default,
Source§fn default() -> TypedSideOffsets2D<T, U>
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,
impl<T, U> Hash for TypedSideOffsets2D<T, U>where
T: Hash,
Source§impl<T, U> PartialEq for TypedSideOffsets2D<T, U>where
T: PartialEq,
impl<T, U> PartialEq for TypedSideOffsets2D<T, U>where
T: PartialEq,
impl<T, U> Copy for TypedSideOffsets2D<T, U>where
T: Copy,
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>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for TypedSideOffsets2D<T, U>
impl<T, U> Sync for TypedSideOffsets2D<T, U>
impl<T, U> Unpin for TypedSideOffsets2D<T, U>
impl<T, U> UnwindSafe for TypedSideOffsets2D<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
Mutably borrows from an owned value. Read more