#[repr(transparent)]pub struct Au(pub i32);
Expand description
An App Unit, the fundamental unit of length in Servo. Usually
1/60th of a pixel (see AU_PER_PX
)
Please ensure that the values are between MIN_AU
and MAX_AU
.
It is safe to construct invalid Au
values, but it may lead to
panics and overflows.
Tuple Fields§
§0: i32
Implementations§
source§impl Au
impl Au
sourcepub fn new(value: i32) -> Au
pub fn new(value: i32) -> Au
FIXME(pcwalton): Workaround for lack of cross crate inlining of newtype structs!
pub fn scale_by(self, factor: f32) -> Au
sourcepub fn scale_by_trunc(self, factor: f32) -> Au
pub fn scale_by_trunc(self, factor: f32) -> Au
Scale, but truncate (useful for viewport-relative units)
pub fn from_f64_au(float: f64) -> Au
pub fn from_px(px: i32) -> Au
sourcepub fn ceil_to_px(self) -> i32
pub fn ceil_to_px(self) -> i32
Ceil this app unit to the appropriate pixel boundary and return it.
pub fn to_nearest_px(self) -> i32
pub fn to_nearest_pixel(self, pixels_per_px: f32) -> f32
pub fn to_f32_px(self) -> f32
pub fn to_f64_px(self) -> f64
pub fn from_f32_px(px: f32) -> Au
pub fn from_f64_px(px: f64) -> Au
pub fn abs(self) -> Au
pub fn max_assign(&mut self, other: Au)
pub fn min_assign(&mut self, other: Au)
Trait Implementations§
source§impl AddAssign for Au
impl AddAssign for Au
source§fn add_assign(&mut self, other: Au)
fn add_assign(&mut self, other: Au)
Performs the
+=
operation. Read moresource§impl ComputeSquaredDistance for Au
impl ComputeSquaredDistance for Au
source§fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
Computes the squared distance between two animatable values.
source§impl<'de> Deserialize<'de> for Au
impl<'de> Deserialize<'de> for Au
source§fn deserialize<D>(
deserializer: D,
) -> Result<Au, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Au, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl DivAssign<i32> for Au
impl DivAssign<i32> for Au
source§fn div_assign(&mut self, other: i32)
fn div_assign(&mut self, other: i32)
Performs the
/=
operation. Read moresource§impl From<Au> for CSSPixelLength
impl From<Au> for CSSPixelLength
source§impl From<Au> for NonNegativeLength
impl From<Au> for NonNegativeLength
source§impl From<CSSPixelLength> for Au
impl From<CSSPixelLength> for Au
source§fn from(len: CSSPixelLength) -> Self
fn from(len: CSSPixelLength) -> Self
Converts to this type from the input type.
source§impl From<NonNegative<CSSPixelLength>> for Au
impl From<NonNegative<CSSPixelLength>> for Au
source§fn from(non_negative_len: NonNegativeLength) -> Self
fn from(non_negative_len: NonNegativeLength) -> Self
Converts to this type from the input type.
source§impl MallocSizeOf for Au
impl MallocSizeOf for Au
source§fn size_of(&self, _: &mut MallocSizeOfOps) -> usize
fn size_of(&self, _: &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 MulAssign<i32> for Au
impl MulAssign<i32> for Au
source§fn mul_assign(&mut self, other: i32)
fn mul_assign(&mut self, other: i32)
Performs the
*=
operation. Read moresource§impl Ord for Au
impl Ord for Au
source§impl PartialOrd for Au
impl PartialOrd for Au
source§impl Serialize for Au
impl Serialize for Au
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 SubAssign for Au
impl SubAssign for Au
source§fn sub_assign(&mut self, other: Au)
fn sub_assign(&mut self, other: Au)
Performs the
-=
operation. Read moresource§impl ToAnimatedValue for Au
impl ToAnimatedValue for Au
source§type AnimatedValue = CSSPixelLength
type AnimatedValue = CSSPixelLength
The type of the animated value.
source§fn to_animated_value(self, context: &Context<'_>) -> Self::AnimatedValue
fn to_animated_value(self, context: &Context<'_>) -> Self::AnimatedValue
Converts this value to an animated value.
source§fn from_animated_value(animated: Self::AnimatedValue) -> Self
fn from_animated_value(animated: Self::AnimatedValue) -> Self
Converts back an animated value into a computed value.
source§impl ToAnimatedZero for Au
impl ToAnimatedZero for Au
source§fn to_animated_zero(&self) -> Result<Self, ()>
fn to_animated_zero(&self) -> Result<Self, ()>
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 ToResolvedValue for Au
impl ToResolvedValue for Au
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<'_>) -> Self::ResolvedValue
fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
Convert a resolved value to a resolved value.
source§fn from_resolved_value(resolved: Self::ResolvedValue) -> Self
fn from_resolved_value(resolved: Self::ResolvedValue) -> Self
Convert a resolved value to resolved value form.
impl Copy for Au
impl Eq for Au
impl StructuralPartialEq for Au
Auto Trait Implementations§
impl Freeze for Au
impl RefUnwindSafe for Au
impl Send for Au
impl Sync for Au
impl Unpin for Au
impl UnwindSafe for Au
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§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
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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