Struct style::values::computed::Au
[−]
[src]
pub struct Au(pub i32);
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.
Methods
impl Au
[src]
pub fn new(value: i32) -> Au
[src]
FIXME(pcwalton): Workaround for lack of cross crate inlining of newtype structs!
pub fn scale_by(self, factor: f32) -> Au
[src]
pub fn scale_by_trunc(self, factor: f32) -> Au
[src]
Scale, but truncate (useful for viewport-relative units)
pub fn from_f64_au(float: f64) -> Au
[src]
pub fn from_px(px: i32) -> Au
[src]
pub fn to_px(self) -> i32
[src]
Rounds this app unit down to the pixel towards zero and returns it.
pub fn ceil_to_px(self) -> i32
[src]
Ceil this app unit to the appropriate pixel boundary and return it.
pub fn to_nearest_px(self) -> i32
[src]
pub fn to_nearest_pixel(self, pixels_per_px: f32) -> f32
[src]
pub fn to_f32_px(self) -> f32
[src]
pub fn to_f64_px(self) -> f64
[src]
pub fn from_f32_px(px: f32) -> Au
[src]
pub fn from_f64_px(px: f64) -> Au
[src]
pub fn abs(self) -> Au
[src]
Trait Implementations
impl ToCss for Au
[src]
fn to_css<W>(&self, dest: &mut W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
Serialize self
in CSS syntax, writing to dest
.
fn to_css_string(&self) -> String
[src]
Serialize self
in CSS syntax and return a string. Read more
impl Sub<Au> for Au
[src]
type Output = Au
The resulting type after applying the -
operator.
fn sub(self, other: Au) -> Au
[src]
Performs the -
operation.
impl Default for Au
[src]
impl<'de> Deserialize<'de> for Au
[src]
fn deserialize<D>(
deserializer: D
) -> Result<Au, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
deserializer: D
) -> Result<Au, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
impl PartialOrd<Au> for Au
[src]
fn partial_cmp(&self, __arg_0: &Au) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Au) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Au) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Au) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Au) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Add<Au> for Au
[src]
type Output = Au
The resulting type after applying the +
operator.
fn add(self, other: Au) -> Au
[src]
Performs the +
operation.
impl PartialEq<Au> for Au
[src]
fn eq(&self, __arg_0: &Au) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Au) -> bool
[src]
This method tests for !=
.
impl Ord for Au
[src]
fn cmp(&self, __arg_0: &Au) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl Div<Au> for Au
[src]
impl Div<i32> for Au
[src]
impl Copy for Au
[src]
impl Zero for Au
[src]
fn zero() -> Au
[src]
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
[src]
Returns true
if self
is equal to the additive identity.
impl Serialize for Au
[src]
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl Debug for Au
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more
impl Eq for Au
[src]
impl Mul<i32> for Au
[src]
type Output = Au
The resulting type after applying the *
operator.
fn mul(self, other: i32) -> Au
[src]
Performs the *
operation.
impl Mul<Au> for i32
[src]
type Output = Au
The resulting type after applying the *
operator.
fn mul(self, other: Au) -> Au
[src]
Performs the *
operation.
impl DivAssign<i32> for Au
[src]
fn div_assign(&mut self, other: i32)
[src]
impl Hash for Au
[src]
fn hash<__H>(&self, __arg_0: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl SubAssign<Au> for Au
[src]
fn sub_assign(&mut self, other: Au)
[src]
Performs the -=
operation.
impl Rem<Au> for Au
[src]
impl Rem<i32> for Au
[src]
impl Neg for Au
[src]
type Output = Au
The resulting type after applying the -
operator.
fn neg(self) -> Au
[src]
Performs the unary -
operation.
impl MulAssign<i32> for Au
[src]
fn mul_assign(&mut self, other: i32)
[src]
impl AddAssign<Au> for Au
[src]
fn add_assign(&mut self, other: Au)
[src]
impl Clone for Au
[src]
fn clone(&self) -> Au
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl MallocSizeOf for Au
[src]
fn size_of(&self, &mut MallocSizeOfOps) -> usize
[src]
Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more
impl Animate for Au
[src]
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()>
[src]
Animate a value towards another one, given an animation procedure.
impl AnimatedValueAsComputed for Au
[src]
impl ToAnimatedZero for Au
[src]
fn to_animated_zero(&self) -> Result<Self, ()>
[src]
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
impl From<Au> for LengthOrPercentage
[src]
impl From<CSSPixelLength> for Au
[src]
fn from(len: CSSPixelLength) -> Self
[src]
Performs the conversion.
impl From<Au> for CSSPixelLength
[src]
impl From<Au> for NonNegativeLength
[src]
impl From<NonNegativeLength> for Au
[src]
fn from(non_negative_len: NonNegativeLength) -> Self
[src]
Performs the conversion.
impl From<Au> for SVGLength
[src]
impl ComputeSquaredDistance for Au
[src]
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
[src]
Computes the squared distance between two animatable values.