pub struct CSSPixelLength(/* private fields */);Expand description
The computed <length> value.
Implementations§
Source§impl CSSPixelLength
impl CSSPixelLength
Sourcepub fn new(px: f32) -> CSSPixelLength
pub fn new(px: f32) -> CSSPixelLength
Return a new CSSPixelLength.
Sourcepub fn normalized(self) -> CSSPixelLength
pub fn normalized(self) -> CSSPixelLength
Returns a normalized (NaN turned to zero) version of this length.
Sourcepub fn finite(self) -> CSSPixelLength
pub fn finite(self) -> CSSPixelLength
Returns a finite (normalized and clamped to float min and max) version of this length.
Sourcepub fn scale_by(self, scale: f32) -> CSSPixelLength
pub fn scale_by(self, scale: f32) -> CSSPixelLength
Scale the length by a given amount.
Sourcepub fn zoom(self, zoom: Zoom) -> CSSPixelLength
pub fn zoom(self, zoom: Zoom) -> CSSPixelLength
Zooms a particular length.
Sourcepub fn abs(self) -> CSSPixelLength
pub fn abs(self) -> CSSPixelLength
Return the absolute value of this length.
Sourcepub fn clamp_to_non_negative(self) -> CSSPixelLength
pub fn clamp_to_non_negative(self) -> CSSPixelLength
Return the clamped value of this length.
Sourcepub fn min(self, other: CSSPixelLength) -> CSSPixelLength
pub fn min(self, other: CSSPixelLength) -> CSSPixelLength
Returns the minimum between self and other.
Sourcepub fn max(self, other: CSSPixelLength) -> CSSPixelLength
pub fn max(self, other: CSSPixelLength) -> CSSPixelLength
Returns the maximum between self and other.
Sourcepub fn max_assign(&mut self, other: CSSPixelLength)
pub fn max_assign(&mut self, other: CSSPixelLength)
Sets self to the maximum between self and other.
Sourcepub fn clamp_between_extremums(
self,
min_size: CSSPixelLength,
max_size: Option<CSSPixelLength>,
) -> CSSPixelLength
pub fn clamp_between_extremums( self, min_size: CSSPixelLength, max_size: Option<CSSPixelLength>, ) -> CSSPixelLength
Clamp the value to a lower bound and an optional upper bound.
Can be used for example with min-width and max-width.
Sourcepub fn clamp_below_max(self, max_size: Option<CSSPixelLength>) -> CSSPixelLength
pub fn clamp_below_max(self, max_size: Option<CSSPixelLength>) -> CSSPixelLength
Clamp the value to an optional upper bound.
Can be used for example with max-width.
Trait Implementations§
Source§impl Add for CSSPixelLength
impl Add for CSSPixelLength
Source§type Output = CSSPixelLength
type Output = CSSPixelLength
The resulting type after applying the
+ operator.Source§fn add(self, other: CSSPixelLength) -> CSSPixelLength
fn add(self, other: CSSPixelLength) -> CSSPixelLength
Performs the
+ operation. Read moreSource§impl AddAssign for CSSPixelLength
impl AddAssign for CSSPixelLength
Source§fn add_assign(&mut self, other: CSSPixelLength)
fn add_assign(&mut self, other: CSSPixelLength)
Performs the
+= operation. Read moreSource§impl Animate for CSSPixelLength
impl Animate for CSSPixelLength
Source§fn animate(
&self,
other: &CSSPixelLength,
procedure: Procedure,
) -> Result<CSSPixelLength, ()>
fn animate( &self, other: &CSSPixelLength, procedure: Procedure, ) -> Result<CSSPixelLength, ()>
Animate a value towards another one, given an animation procedure.
Source§impl ClampToNonNegative for CSSPixelLength
impl ClampToNonNegative for CSSPixelLength
Source§fn clamp_to_non_negative(self) -> CSSPixelLength
fn clamp_to_non_negative(self) -> CSSPixelLength
Clamps the value to be non-negative after an animation.
Source§impl Clone for CSSPixelLength
impl Clone for CSSPixelLength
Source§fn clone(&self) -> CSSPixelLength
fn clone(&self) -> CSSPixelLength
Returns a duplicate 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 ComputeSquaredDistance for CSSPixelLength
impl ComputeSquaredDistance for CSSPixelLength
Source§fn compute_squared_distance(
&self,
other: &CSSPixelLength,
) -> Result<SquaredDistance, ()>
fn compute_squared_distance( &self, other: &CSSPixelLength, ) -> Result<SquaredDistance, ()>
Computes the squared distance between two animatable values.
Source§impl Debug for CSSPixelLength
impl Debug for CSSPixelLength
Source§impl<'de> Deserialize<'de> for CSSPixelLength
impl<'de> Deserialize<'de> for CSSPixelLength
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CSSPixelLength, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CSSPixelLength, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Div<f32> for CSSPixelLength
impl Div<f32> for CSSPixelLength
Source§type Output = CSSPixelLength
type Output = CSSPixelLength
The resulting type after applying the
/ operator.Source§impl Div for CSSPixelLength
impl Div for CSSPixelLength
Source§impl From<Au> for CSSPixelLength
impl From<Au> for CSSPixelLength
Source§fn from(len: Au) -> CSSPixelLength
fn from(len: Au) -> CSSPixelLength
Converts to this type from the input type.
Source§impl From<CSSPixelLength> for NonNegative<CSSPixelLength>
impl From<CSSPixelLength> for NonNegative<CSSPixelLength>
Source§fn from(len: CSSPixelLength) -> NonNegative<CSSPixelLength>
fn from(len: CSSPixelLength) -> NonNegative<CSSPixelLength>
Converts to this type from the input type.
Source§impl MallocSizeOf for CSSPixelLength
impl MallocSizeOf for CSSPixelLength
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
Source§impl Mul<f32> for CSSPixelLength
impl Mul<f32> for CSSPixelLength
Source§type Output = CSSPixelLength
type Output = CSSPixelLength
The resulting type after applying the
* operator.Source§impl MulAssign<f32> for CSSPixelLength
impl MulAssign<f32> for CSSPixelLength
Source§fn mul_assign(&mut self, other: f32)
fn mul_assign(&mut self, other: f32)
Performs the
*= operation. Read moreSource§impl Neg for CSSPixelLength
impl Neg for CSSPixelLength
Source§type Output = CSSPixelLength
type Output = CSSPixelLength
The resulting type after applying the
- operator.Source§fn neg(self) -> CSSPixelLength
fn neg(self) -> CSSPixelLength
Performs the unary
- operation. Read moreSource§impl PartialEq for CSSPixelLength
impl PartialEq for CSSPixelLength
Source§impl PartialOrd for CSSPixelLength
impl PartialOrd for CSSPixelLength
Source§impl Serialize for CSSPixelLength
impl Serialize for CSSPixelLength
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,
Serialize this value into the given Serde serializer. Read more
Source§impl Sub for CSSPixelLength
impl Sub for CSSPixelLength
Source§type Output = CSSPixelLength
type Output = CSSPixelLength
The resulting type after applying the
- operator.Source§fn sub(self, other: CSSPixelLength) -> CSSPixelLength
fn sub(self, other: CSSPixelLength) -> CSSPixelLength
Performs the
- operation. Read moreSource§impl SubAssign for CSSPixelLength
impl SubAssign for CSSPixelLength
Source§fn sub_assign(&mut self, other: CSSPixelLength)
fn sub_assign(&mut self, other: CSSPixelLength)
Performs the
-= operation. Read moreSource§impl Sum for CSSPixelLength
impl Sum for CSSPixelLength
Source§fn sum<I>(iter: I) -> CSSPixelLengthwhere
I: Iterator<Item = CSSPixelLength>,
fn sum<I>(iter: I) -> CSSPixelLengthwhere
I: Iterator<Item = CSSPixelLength>,
Takes an iterator and generates
Self from the elements by “summing up”
the items.Source§impl ToAbsoluteLength for CSSPixelLength
impl ToAbsoluteLength for CSSPixelLength
Source§fn to_pixel_length(
&self,
_containing_len: Option<CSSPixelLength>,
) -> Result<f32, ()>
fn to_pixel_length( &self, _containing_len: Option<CSSPixelLength>, ) -> Result<f32, ()>
Returns the absolute length as pixel value.
Source§impl ToAnimatedValue for CSSPixelLength
impl ToAnimatedValue for CSSPixelLength
Source§type AnimatedValue = CSSPixelLength
type AnimatedValue = CSSPixelLength
The type of the animated value.
Source§fn to_animated_value(
self,
context: &Context<'_>,
) -> <CSSPixelLength as ToAnimatedValue>::AnimatedValue
fn to_animated_value( self, context: &Context<'_>, ) -> <CSSPixelLength as ToAnimatedValue>::AnimatedValue
Converts this value to an animated value.
Source§fn from_animated_value(
value: <CSSPixelLength as ToAnimatedValue>::AnimatedValue,
) -> CSSPixelLength
fn from_animated_value( value: <CSSPixelLength as ToAnimatedValue>::AnimatedValue, ) -> CSSPixelLength
Converts back an animated value into a computed value.
Source§impl ToAnimatedZero for CSSPixelLength
impl ToAnimatedZero for CSSPixelLength
Source§fn to_animated_zero(&self) -> Result<CSSPixelLength, ()>
fn to_animated_zero(&self) -> Result<CSSPixelLength, ()>
Returns a value that, when added with an underlying value, will produce the underlying
value. This is used for SMIL animation’s “by-animation” where SMIL first interpolates from
the zero value to the ‘by’ value, and then adds the result to the underlying value. Read more
Source§impl ToComputedValue for CSSPixelLength
impl ToComputedValue for CSSPixelLength
Source§type ComputedValue = CSSPixelLength
type ComputedValue = CSSPixelLength
The computed value type we’re going to be converted to.
Source§fn from_computed_value(
from: &<CSSPixelLength as ToComputedValue>::ComputedValue,
) -> CSSPixelLength
fn from_computed_value( from: &<CSSPixelLength as ToComputedValue>::ComputedValue, ) -> CSSPixelLength
Convert a computed value to specified value form. Read more
Source§fn to_computed_value(
&self,
context: &Context<'_>,
) -> <CSSPixelLength as ToComputedValue>::ComputedValue
fn to_computed_value( &self, context: &Context<'_>, ) -> <CSSPixelLength as ToComputedValue>::ComputedValue
Convert a specified value to a computed value, using itself and the data
inside the
Context.Source§impl ToCss for CSSPixelLength
impl ToCss for CSSPixelLength
Source§fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Result<(), Error>where
W: Write,
fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Result<(), Error>where
W: Write,
Serialize
self in CSS syntax, writing to dest.Source§fn to_css_string(&self) -> String
fn to_css_string(&self) -> String
Serialize
self in CSS syntax and return a string. Read moreSource§fn to_css_cssstring(&self) -> String
fn to_css_cssstring(&self) -> String
Serialize
self in CSS syntax and return a CssString. Read moreSource§impl ToResolvedValue for CSSPixelLength
impl ToResolvedValue for CSSPixelLength
Source§type ResolvedValue = CSSPixelLength
type ResolvedValue = CSSPixelLength
The resolved value type we’re going to be converted to.
Source§fn to_resolved_value(
self,
context: &Context<'_>,
) -> <CSSPixelLength as ToResolvedValue>::ResolvedValue
fn to_resolved_value( self, context: &Context<'_>, ) -> <CSSPixelLength as ToResolvedValue>::ResolvedValue
Convert a resolved value to a resolved value.
Source§fn from_resolved_value(
value: <CSSPixelLength as ToResolvedValue>::ResolvedValue,
) -> CSSPixelLength
fn from_resolved_value( value: <CSSPixelLength as ToResolvedValue>::ResolvedValue, ) -> CSSPixelLength
Convert a resolved value to resolved value form.
Source§impl ToShmem for CSSPixelLength
impl ToShmem for CSSPixelLength
Source§fn to_shmem(
&self,
builder: &mut SharedMemoryBuilder,
) -> Result<ManuallyDrop<CSSPixelLength>, String>
fn to_shmem( &self, builder: &mut SharedMemoryBuilder, ) -> Result<ManuallyDrop<CSSPixelLength>, String>
Clones this value into a form suitable for writing into a
SharedMemoryBuilder. Read more
Source§impl ToTyped for CSSPixelLength
impl ToTyped for CSSPixelLength
Source§fn to_typed(&self) -> Option<TypedValue>
fn to_typed(&self) -> Option<TypedValue>
Source§impl Zero for CSSPixelLength
impl Zero for CSSPixelLength
impl Copy for CSSPixelLength
impl StructuralPartialEq for CSSPixelLength
Auto Trait Implementations§
impl Freeze for CSSPixelLength
impl RefUnwindSafe for CSSPixelLength
impl Send for CSSPixelLength
impl Sync for CSSPixelLength
impl Unpin for CSSPixelLength
impl UnsafeUnpin for CSSPixelLength
impl UnwindSafe for CSSPixelLength
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert