Struct zng_layout::unit::SideOffsets
source · pub struct SideOffsets {
pub top: Length,
pub right: Length,
pub bottom: Length,
pub left: Length,
}
Expand description
2D size offsets in Length
units.
This unit defines spacing around all four sides of a box, a widget margin can be defined using a value of this type.
Fields§
§top: Length
Spacing above, in length units.
right: Length
Spacing to the right, in length units.
bottom: Length
Spacing bellow, in length units.
left: Length
Spacing to the left ,in length units.
Implementations§
source§impl SideOffsets
impl SideOffsets
sourcepub fn new<T: Into<Length>, R: Into<Length>, B: Into<Length>, L: Into<Length>>(
top: T,
right: R,
bottom: B,
left: L,
) -> Self
pub fn new<T: Into<Length>, R: Into<Length>, B: Into<Length>, L: Into<Length>>( top: T, right: R, bottom: B, left: L, ) -> Self
New top, right, bottom left offsets. From any Length
type.
sourcepub fn new_vh<TB: Into<Length>, LR: Into<Length>>(
top_bottom: TB,
left_right: LR,
) -> Self
pub fn new_vh<TB: Into<Length>, LR: Into<Length>>( top_bottom: TB, left_right: LR, ) -> Self
Top-bottom and left-right equal. From any Length
type.
sourcepub fn dimensions_eq(&self) -> bool
pub fn dimensions_eq(&self) -> bool
If top and bottom are equal; and left and right are equal.
Trait Implementations§
source§impl Add for SideOffsets
impl Add for SideOffsets
source§impl AddAssign for SideOffsets
impl AddAssign for SideOffsets
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§impl Clone for SideOffsets
impl Clone for SideOffsets
source§fn clone(&self) -> SideOffsets
fn clone(&self) -> SideOffsets
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 Debug for SideOffsets
impl Debug for SideOffsets
source§impl Default for SideOffsets
impl Default for SideOffsets
source§fn default() -> SideOffsets
fn default() -> SideOffsets
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for SideOffsets
impl<'de> Deserialize<'de> for SideOffsets
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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<'a, S: Into<FactorSideOffsets>> Div<S> for &'a SideOffsets
impl<'a, S: Into<FactorSideOffsets>> Div<S> for &'a SideOffsets
source§impl<S: Into<FactorSideOffsets>> Div<S> for SideOffsets
impl<S: Into<FactorSideOffsets>> Div<S> for SideOffsets
source§impl<S: Into<FactorSideOffsets>> DivAssign<S> for SideOffsets
impl<S: Into<FactorSideOffsets>> DivAssign<S> for SideOffsets
source§fn div_assign(&mut self, rhs: S)
fn div_assign(&mut self, rhs: S)
Performs the
/=
operation. Read moresource§impl<T, R, B, L> From<(T, R, B, L)> for SideOffsets
impl<T, R, B, L> From<(T, R, B, L)> for SideOffsets
source§fn from((top, right, bottom, left): (T, R, B, L)) -> Self
fn from((top, right, bottom, left): (T, R, B, L)) -> Self
(top, right, bottom, left)
source§impl<TB, LR> From<(TB, LR)> for SideOffsets
impl<TB, LR> From<(TB, LR)> for SideOffsets
source§impl From<Factor> for SideOffsets
impl From<Factor> for SideOffsets
source§impl From<FactorPercent> for SideOffsets
impl From<FactorPercent> for SideOffsets
source§fn from(percent: FactorPercent) -> Self
fn from(percent: FactorPercent) -> Self
All sides equal relative length.
source§impl From<SideOffsets2D<Dip, Dip>> for SideOffsets
impl From<SideOffsets2D<Dip, Dip>> for SideOffsets
source§fn from(offsets: DipSideOffsets) -> Self
fn from(offsets: DipSideOffsets) -> Self
Converts to this type from the input type.
source§impl From<SideOffsets2D<Px, Px>> for SideOffsets
impl From<SideOffsets2D<Px, Px>> for SideOffsets
source§fn from(offsets: PxSideOffsets) -> Self
fn from(offsets: PxSideOffsets) -> Self
From exact lengths.
source§impl<T, R, B, L> IntoVar<SideOffsets> for (T, R, B, L)
impl<T, R, B, L> IntoVar<SideOffsets> for (T, R, B, L)
source§impl<TB, LR> IntoVar<SideOffsets> for (TB, LR)
impl<TB, LR> IntoVar<SideOffsets> for (TB, LR)
source§impl IntoVar<SideOffsets> for Factor
impl IntoVar<SideOffsets> for Factor
source§impl IntoVar<SideOffsets> for FactorPercent
impl IntoVar<SideOffsets> for FactorPercent
source§impl IntoVar<SideOffsets> for Length
impl IntoVar<SideOffsets> for Length
source§impl IntoVar<SideOffsets> for DipSideOffsets
impl IntoVar<SideOffsets> for DipSideOffsets
source§impl IntoVar<SideOffsets> for PxSideOffsets
impl IntoVar<SideOffsets> for PxSideOffsets
source§impl IntoVar<SideOffsets> for f32
impl IntoVar<SideOffsets> for f32
source§impl IntoVar<SideOffsets> for i32
impl IntoVar<SideOffsets> for i32
source§impl Layout2d for SideOffsets
impl Layout2d for SideOffsets
source§fn layout_dft(&self, default: Self::Px) -> Self::Px
fn layout_dft(&self, default: Self::Px) -> Self::Px
Compute the pixel value in the current
LAYOUT
context with default
.source§fn affect_mask(&self) -> LayoutMask
fn affect_mask(&self) -> LayoutMask
Compute a
LayoutMask
that flags all contextual values that affect the result of layout
.source§impl<'a, S: Into<FactorSideOffsets>> Mul<S> for &'a SideOffsets
impl<'a, S: Into<FactorSideOffsets>> Mul<S> for &'a SideOffsets
source§impl<S: Into<FactorSideOffsets>> Mul<S> for SideOffsets
impl<S: Into<FactorSideOffsets>> Mul<S> for SideOffsets
source§impl<S: Into<FactorSideOffsets>> MulAssign<S> for SideOffsets
impl<S: Into<FactorSideOffsets>> MulAssign<S> for SideOffsets
source§fn mul_assign(&mut self, rhs: S)
fn mul_assign(&mut self, rhs: S)
Performs the
*=
operation. Read moresource§impl PartialEq for SideOffsets
impl PartialEq for SideOffsets
source§impl Serialize for SideOffsets
impl Serialize for SideOffsets
source§impl Sub for SideOffsets
impl Sub for SideOffsets
source§impl SubAssign for SideOffsets
impl SubAssign for SideOffsets
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moresource§impl Transitionable for SideOffsets
impl Transitionable for SideOffsets
source§fn lerp(self, to: &Self, step: EasingStep) -> Self
fn lerp(self, to: &Self, step: EasingStep) -> Self
Sample the linear interpolation from
self
-> to
by step
.impl IntoValue<SideOffsets> for Factor
impl IntoValue<SideOffsets> for FactorPercent
impl IntoValue<SideOffsets> for Length
impl IntoValue<SideOffsets> for DipSideOffsets
impl IntoValue<SideOffsets> for PxSideOffsets
impl IntoValue<SideOffsets> for f32
impl IntoValue<SideOffsets> for i32
impl StructuralPartialEq for SideOffsets
Auto Trait Implementations§
impl Freeze for SideOffsets
impl RefUnwindSafe for SideOffsets
impl Send for SideOffsets
impl Sync for SideOffsets
impl Unpin for SideOffsets
impl UnwindSafe for SideOffsets
Blanket Implementations§
source§impl<T> AnyVarValue for Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Access to mut
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
Clone the value.
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
Clone the value into a new boxed
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
Gets if
self
equals other
.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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more