Struct app_units::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]
fn new(value: i32) -> Au
FIXME(pcwalton): Workaround for lack of cross crate inlining of newtype structs!
fn scale_by(self, factor: f32) -> Au
fn from_px(px: i32) -> Au
fn to_px(self) -> i32
Rounds this app unit down to the pixel towards zero and returns it.
fn ceil_to_px(self) -> i32
Ceil this app unit to the appropriate pixel boundary and return it.
fn to_nearest_px(self) -> i32
fn to_nearest_pixel(self, pixels_per_px: f32) -> f32
fn to_f32_px(self) -> f32
fn to_f64_px(self) -> f64
fn from_f32_px(px: f32) -> Au
fn from_f64_px(px: f64) -> Au
Trait Implementations
impl Clone for Au
[src]
fn clone(&self) -> Au
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Copy for Au
[src]
impl Hash for Au
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for Au
[src]
fn eq(&self, __arg_0: &Au) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Au) -> bool
This method tests for !=
.
impl PartialOrd for Au
[src]
fn partial_cmp(&self, __arg_0: &Au) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Au) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Au) -> bool
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
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Au) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Eq for Au
[src]
impl Ord for Au
[src]
fn cmp(&self, __arg_0: &Au) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl HeapSizeOf for Au
[src]
fn heap_size_of_children(&self) -> usize
Measure the size of any heap-allocated structures that hang off this value, but not the space taken up by the value itself (i.e. what size_of:: measures, more or less); that space is handled by the implementation of HeapSizeOf for Box below. Read more
impl Deserialize for Au
[src]
fn deserialize<D: Deserializer>(deserializer: D) -> Result<Au, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Serialize for Au
[src]
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>
Serialize this value into the given Serde serializer. Read more
impl Default for Au
[src]
impl Zero for Au
[src]
fn zero() -> Au
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl Encodable for Au
[src]
impl Debug for Au
[src]
impl Add for Au
[src]
type Output = Au
The resulting type after applying the +
operator
fn add(self, other: Au) -> Au
The method for the +
operator
impl Sub for Au
[src]
type Output = Au
The resulting type after applying the -
operator
fn sub(self, other: Au) -> Au
The method for the -
operator
impl Mul<i32> for Au
[src]
type Output = Au
The resulting type after applying the *
operator
fn mul(self, other: i32) -> Au
The method for the *
operator
impl Div<i32> for Au
[src]
type Output = Au
The resulting type after applying the /
operator
fn div(self, other: i32) -> Au
The method for the /
operator
impl Rem<i32> for Au
[src]
type Output = Au
The resulting type after applying the %
operator
fn rem(self, other: i32) -> Au
The method for the %
operator
impl Neg for Au
[src]
type Output = Au
The resulting type after applying the -
operator
fn neg(self) -> Au
The method for the unary -
operator
impl AddAssign for Au
[src]
fn add_assign(&mut self, other: Au)
The method for the +=
operator
impl SubAssign for Au
[src]
fn sub_assign(&mut self, other: Au)
The method for the -=
operator
impl MulAssign<i32> for Au
[src]
fn mul_assign(&mut self, other: i32)
The method for the *=
operator
impl DivAssign<i32> for Au
[src]
fn div_assign(&mut self, other: i32)
The method for the /=
operator