Struct zng::layout::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, R, B, L>(top: T, right: R, bottom: B, left: L) -> SideOffsets
pub fn new<T, R, B, L>(top: T, right: R, bottom: B, left: L) -> SideOffsets
New top, right, bottom left offsets. From any Length
type.
sourcepub fn new_vh<TB, LR>(top_bottom: TB, left_right: LR) -> SideOffsets
pub fn new_vh<TB, LR>(top_bottom: TB, left_right: LR) -> SideOffsets
Top-bottom and left-right equal. From any Length
type.
sourcepub fn new_all<T>(all_sides: T) -> SideOffsets
pub fn new_all<T>(all_sides: T) -> SideOffsets
All sides equal. From any Length
type.
sourcepub fn zero() -> SideOffsets
pub fn zero() -> SideOffsets
All sides zero.
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§type Output = SideOffsets
type Output = SideOffsets
+
operator.source§fn add(self, rhs: SideOffsets) -> SideOffsets
fn add(self, rhs: SideOffsets) -> SideOffsets
+
operation. Read moresource§impl AddAssign for SideOffsets
impl AddAssign for SideOffsets
source§fn add_assign(&mut self, rhs: SideOffsets)
fn add_assign(&mut self, rhs: SideOffsets)
+=
operation. Read moresource§impl Clone for SideOffsets
impl Clone for SideOffsets
source§fn clone(&self) -> SideOffsets
fn clone(&self) -> SideOffsets
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
source§impl<'de> Deserialize<'de> for SideOffsets
impl<'de> Deserialize<'de> for SideOffsets
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SideOffsets, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SideOffsets, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl<'a, S> Div<S> for &'a SideOffsetswhere
S: Into<FactorSideOffsets>,
impl<'a, S> Div<S> for &'a SideOffsetswhere
S: Into<FactorSideOffsets>,
source§impl<S> Div<S> for SideOffsetswhere
S: Into<FactorSideOffsets>,
impl<S> Div<S> for SideOffsetswhere
S: Into<FactorSideOffsets>,
source§type Output = SideOffsets
type Output = SideOffsets
/
operator.source§fn div(self, rhs: S) -> SideOffsets
fn div(self, rhs: S) -> SideOffsets
/
operation. Read moresource§impl<S> DivAssign<S> for SideOffsetswhere
S: Into<FactorSideOffsets>,
impl<S> DivAssign<S> for SideOffsetswhere
S: Into<FactorSideOffsets>,
source§fn div_assign(&mut self, rhs: S)
fn div_assign(&mut self, rhs: S)
/=
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(_: (T, R, B, L)) -> SideOffsets
fn from(_: (T, R, B, L)) -> SideOffsets
(top, right, bottom, left)
source§impl<TB, LR> From<(TB, LR)> for SideOffsets
impl<TB, LR> From<(TB, LR)> for SideOffsets
source§fn from(_: (TB, LR)) -> SideOffsets
fn from(_: (TB, LR)) -> SideOffsets
(top-bottom, left-right)
source§impl From<Factor> for SideOffsets
impl From<Factor> for SideOffsets
source§fn from(norm: Factor) -> SideOffsets
fn from(norm: Factor) -> SideOffsets
All sides equal relative length.
source§impl From<FactorPercent> for SideOffsets
impl From<FactorPercent> for SideOffsets
source§fn from(percent: FactorPercent) -> SideOffsets
fn from(percent: FactorPercent) -> SideOffsets
All sides equal relative length.
source§impl From<Length> for SideOffsets
impl From<Length> for SideOffsets
source§fn from(all: Length) -> SideOffsets
fn from(all: Length) -> SideOffsets
All sides equal.
source§impl From<SideOffsets2D<Dip, Dip>> for SideOffsets
impl From<SideOffsets2D<Dip, Dip>> for SideOffsets
source§fn from(offsets: SideOffsets2D<Dip, Dip>) -> SideOffsets
fn from(offsets: SideOffsets2D<Dip, Dip>) -> SideOffsets
source§impl From<SideOffsets2D<Px, Px>> for SideOffsets
impl From<SideOffsets2D<Px, Px>> for SideOffsets
source§fn from(offsets: SideOffsets2D<Px, Px>) -> SideOffsets
fn from(offsets: SideOffsets2D<Px, Px>) -> SideOffsets
From exact lengths.
source§impl From<f32> for SideOffsets
impl From<f32> for SideOffsets
source§fn from(f: f32) -> SideOffsets
fn from(f: f32) -> SideOffsets
All sides equal exact length.
source§impl From<i32> for SideOffsets
impl From<i32> for SideOffsets
source§fn from(i: i32) -> SideOffsets
fn from(i: i32) -> SideOffsets
All sides equal exact length.
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§fn into_var(self) -> <(T, R, B, L) as IntoVar<SideOffsets>>::Var
fn into_var(self) -> <(T, R, B, L) as IntoVar<SideOffsets>>::Var
(top, right, bottom, left)
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl<TB, LR> IntoVar<SideOffsets> for (TB, LR)
impl<TB, LR> IntoVar<SideOffsets> for (TB, LR)
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<SideOffsets> for Factor
impl IntoVar<SideOffsets> for Factor
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<SideOffsets> for FactorPercent
impl IntoVar<SideOffsets> for FactorPercent
source§fn into_var(self) -> <FactorPercent as IntoVar<SideOffsets>>::Var
fn into_var(self) -> <FactorPercent as IntoVar<SideOffsets>>::Var
All sides equal relative length.
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<SideOffsets> for Length
impl IntoVar<SideOffsets> for Length
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<SideOffsets> for SideOffsets2D<Dip, Dip>
impl IntoVar<SideOffsets> for SideOffsets2D<Dip, Dip>
source§fn into_var(self) -> <SideOffsets2D<Dip, Dip> as IntoVar<SideOffsets>>::Var
fn into_var(self) -> <SideOffsets2D<Dip, Dip> as IntoVar<SideOffsets>>::Var
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<SideOffsets> for SideOffsets2D<Px, Px>
impl IntoVar<SideOffsets> for SideOffsets2D<Px, Px>
source§fn into_var(self) -> <SideOffsets2D<Px, Px> as IntoVar<SideOffsets>>::Var
fn into_var(self) -> <SideOffsets2D<Px, Px> as IntoVar<SideOffsets>>::Var
From exact lengths.
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<SideOffsets> for f32
impl IntoVar<SideOffsets> for f32
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<SideOffsets> for i32
impl IntoVar<SideOffsets> for i32
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl Layout2d for SideOffsets
impl Layout2d for SideOffsets
source§fn layout_dft(
&self,
default: <SideOffsets as Layout2d>::Px,
) -> <SideOffsets as Layout2d>::Px
fn layout_dft( &self, default: <SideOffsets as Layout2d>::Px, ) -> <SideOffsets as Layout2d>::Px
LAYOUT
context with default
.source§fn affect_mask(&self) -> LayoutMask
fn affect_mask(&self) -> LayoutMask
LayoutMask
that flags all contextual values that affect the result of layout
.source§impl<'a, S> Mul<S> for &'a SideOffsetswhere
S: Into<FactorSideOffsets>,
impl<'a, S> Mul<S> for &'a SideOffsetswhere
S: Into<FactorSideOffsets>,
source§impl<S> Mul<S> for SideOffsetswhere
S: Into<FactorSideOffsets>,
impl<S> Mul<S> for SideOffsetswhere
S: Into<FactorSideOffsets>,
source§type Output = SideOffsets
type Output = SideOffsets
*
operator.source§fn mul(self, rhs: S) -> SideOffsets
fn mul(self, rhs: S) -> SideOffsets
*
operation. Read moresource§impl<S> MulAssign<S> for SideOffsetswhere
S: Into<FactorSideOffsets>,
impl<S> MulAssign<S> for SideOffsetswhere
S: Into<FactorSideOffsets>,
source§fn mul_assign(&mut self, rhs: S)
fn mul_assign(&mut self, rhs: S)
*=
operation. Read moresource§impl PartialEq for SideOffsets
impl PartialEq for SideOffsets
source§impl Serialize for SideOffsets
impl Serialize for SideOffsets
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§impl Sub for SideOffsets
impl Sub for SideOffsets
source§type Output = SideOffsets
type Output = SideOffsets
-
operator.source§fn sub(self, rhs: SideOffsets) -> SideOffsets
fn sub(self, rhs: SideOffsets) -> SideOffsets
-
operation. Read moresource§impl SubAssign for SideOffsets
impl SubAssign for SideOffsets
source§fn sub_assign(&mut self, rhs: SideOffsets)
fn sub_assign(&mut self, rhs: SideOffsets)
-=
operation. Read moresource§impl Transitionable for SideOffsets
impl Transitionable for SideOffsets
source§fn lerp(self, to: &SideOffsets, step: Factor) -> SideOffsets
fn lerp(self, to: &SideOffsets, step: Factor) -> SideOffsets
self
-> to
by step
.impl IntoValue<SideOffsets> for Factor
impl IntoValue<SideOffsets> for FactorPercent
impl IntoValue<SideOffsets> for Length
impl IntoValue<SideOffsets> for SideOffsets2D<Dip, Dip>
impl IntoValue<SideOffsets> for SideOffsets2D<Px, Px>
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§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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)
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
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
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)
clone_to_uninit
)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> FsChangeNote for T
impl<T> FsChangeNote for T
§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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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>
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>
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§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.