Struct style::values::computed::Au

source ·
#[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

source

pub fn new(value: i32) -> Au

FIXME(pcwalton): Workaround for lack of cross crate inlining of newtype structs!

source

pub fn scale_by(self, factor: f32) -> Au

source

pub fn scale_by_trunc(self, factor: f32) -> Au

Scale, but truncate (useful for viewport-relative units)

source

pub fn from_f64_au(float: f64) -> Au

source

pub fn from_px(px: i32) -> Au

source

pub fn to_px(self) -> i32

Round this app unit down to the pixel towards zero and return it.

source

pub fn ceil_to_px(self) -> i32

Ceil this app unit to the appropriate pixel boundary and return it.

source

pub fn to_nearest_px(self) -> i32

source

pub fn to_nearest_pixel(self, pixels_per_px: f32) -> f32

source

pub fn to_f32_px(self) -> f32

source

pub fn to_f64_px(self) -> f64

source

pub fn from_f32_px(px: f32) -> Au

source

pub fn from_f64_px(px: f64) -> Au

source

pub fn abs(self) -> Au

Trait Implementations§

source§

impl Add<Au> for Au

§

type Output = Au

The resulting type after applying the + operator.
source§

fn add(self, other: Au) -> Au

Performs the + operation. Read more
source§

impl AddAssign<Au> for Au

source§

fn add_assign(&mut self, other: Au)

Performs the += operation. Read more
source§

impl Animate for Au

source§

fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()>

Animate a value towards another one, given an animation procedure.
source§

impl Clone for Au

source§

fn clone(&self) -> Au

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ComputeSquaredDistance for Au

source§

fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>

Computes the squared distance between two animatable values.
source§

impl Debug for Au

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for Au

source§

fn default() -> Au

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Au

source§

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 Div<Au> for Au

§

type Output = i32

The resulting type after applying the / operator.
source§

fn div(self, other: Au) -> i32

Performs the / operation. Read more
source§

impl Div<i32> for Au

§

type Output = Au

The resulting type after applying the / operator.
source§

fn div(self, other: i32) -> Au

Performs the / operation. Read more
source§

impl DivAssign<i32> for Au

source§

fn div_assign(&mut self, other: i32)

Performs the /= operation. Read more
source§

impl From<Au> for CSSPixelLength

source§

fn from(len: Au) -> Self

Converts to this type from the input type.
source§

impl From<Au> for NonNegativeLength

source§

fn from(au: Au) -> Self

Converts to this type from the input type.
source§

impl From<CSSPixelLength> for Au

source§

fn from(len: CSSPixelLength) -> Self

Converts to this type from the input type.
source§

impl From<NonNegative<CSSPixelLength>> for Au

source§

fn from(non_negative_len: NonNegativeLength) -> Self

Converts to this type from the input type.
source§

impl Hash for Au

source§

fn hash<__H>(&self, state: &mut __H)where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl MallocSizeOf for Au

source§

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 MallocSizeOf for Au

source§

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 Mul<i32> for Au

§

type Output = Au

The resulting type after applying the * operator.
source§

fn mul(self, other: i32) -> Au

Performs the * operation. Read more
source§

impl MulAssign<i32> for Au

source§

fn mul_assign(&mut self, other: i32)

Performs the *= operation. Read more
source§

impl Neg for Au

§

type Output = Au

The resulting type after applying the - operator.
source§

fn neg(self) -> Au

Performs the unary - operation. Read more
source§

impl Ord for Au

source§

fn cmp(&self, other: &Au) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<Au> for Au

source§

fn eq(&self, other: &Au) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Au> for Au

source§

fn partial_cmp(&self, other: &Au) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Rem<Au> for Au

§

type Output = Au

The resulting type after applying the % operator.
source§

fn rem(self, other: Au) -> Au

Performs the % operation. Read more
source§

impl Rem<i32> for Au

§

type Output = Au

The resulting type after applying the % operator.
source§

fn rem(self, other: i32) -> Au

Performs the % operation. Read more
source§

impl Serialize for Au

source§

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<Au> for Au

§

type Output = Au

The resulting type after applying the - operator.
source§

fn sub(self, other: Au) -> Au

Performs the - operation. Read more
source§

impl SubAssign<Au> for Au

source§

fn sub_assign(&mut self, other: Au)

Performs the -= operation. Read more
source§

impl<'a> Sum<&'a Au> for Au

source§

fn sum<I>(iter: I) -> Auwhere I: Iterator<Item = &'a Au>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<'a> Sum<Au> for Au

source§

fn sum<I>(iter: I) -> Auwhere I: Iterator<Item = Au>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl ToAnimatedValue for Au

§

type AnimatedValue = Au

The type of the animated value.
source§

fn to_animated_value(self) -> Self

Converts this value to an animated value.
source§

fn from_animated_value(animated: Self::AnimatedValue) -> Self

Converts back an animated value into a computed value.
source§

impl ToAnimatedZero for Au

source§

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 ToCss for Au

source§

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

Serialize self in CSS syntax and return a string. Read more
source§

impl ToResolvedValue for Au

§

type ResolvedValue = Au

The resolved value type we’re going to be converted to.
source§

fn to_resolved_value(self, _: &Context<'_>) -> Self

Convert a resolved value to a resolved value.
source§

fn from_resolved_value(resolved: Self::ResolvedValue) -> Self

Convert a resolved value to resolved value form.
source§

impl Zero for Au

source§

fn zero() -> Au

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl Copy for Au

source§

impl Eq for Au

source§

impl StructuralEq for Au

source§

impl StructuralPartialEq for Au

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Comparable<K> for Qwhere Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> MaybeBoxed<Box<T, Global>> for T

source§

fn maybe_boxed(self) -> Box<T, Global>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Zero for Twhere T: Zero,

source§

fn zero() -> T

Returns the zero value.
source§

fn is_zero(&self) -> bool

Returns whether this value is zero.
source§

impl<T> Zero for Twhere T: Zero,

source§

fn zero() -> T

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

source§

impl<T> Erased for T