[−][src]Struct app_units::Au
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]
impl Au
pub fn new(value: i32) -> Au
[src]
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
[src]
pub fn scale_by(self, factor: f32) -> Au
pub fn scale_by_trunc(self, factor: f32) -> Au
[src]
pub fn scale_by_trunc(self, factor: f32) -> Au
Scale, but truncate (useful for viewport-relative units)
pub fn from_f64_au(float: f64) -> Self
[src]
pub fn from_f64_au(float: f64) -> Self
pub fn from_px(px: i32) -> Au
[src]
pub fn from_px(px: i32) -> Au
pub fn to_px(self) -> i32
[src]
pub fn to_px(self) -> i32
Rounds this app unit down to the pixel towards zero and returns it.
pub fn ceil_to_px(self) -> i32
[src]
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
[src]
pub fn to_nearest_px(self) -> i32
pub fn to_nearest_pixel(self, pixels_per_px: f32) -> f32
[src]
pub fn to_nearest_pixel(self, pixels_per_px: f32) -> f32
pub fn to_f32_px(self) -> f32
[src]
pub fn to_f32_px(self) -> f32
pub fn to_f64_px(self) -> f64
[src]
pub fn to_f64_px(self) -> f64
pub fn from_f32_px(px: f32) -> Au
[src]
pub fn from_f32_px(px: f32) -> Au
pub fn from_f64_px(px: f64) -> Au
[src]
pub fn from_f64_px(px: f64) -> Au
pub fn abs(self) -> Self
[src]
pub fn abs(self) -> Self
Trait Implementations
impl PartialOrd<Au> for Au
[src]
impl PartialOrd<Au> for Au
fn partial_cmp(&self, other: &Au) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Au) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Au) -> bool
[src]
fn lt(&self, other: &Au) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Au) -> bool
[src]
fn le(&self, other: &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, other: &Au) -> bool
[src]
fn gt(&self, other: &Au) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Au) -> bool
[src]
fn ge(&self, other: &Au) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq<Au> for Au
[src]
impl PartialEq<Au> for Au
fn eq(&self, other: &Au) -> bool
[src]
fn eq(&self, other: &Au) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Au) -> bool
[src]
fn ne(&self, other: &Au) -> bool
This method tests for !=
.
impl Default for Au
[src]
impl Default for Au
impl Clone for Au
[src]
impl Clone for Au
fn clone(&self) -> Au
[src]
fn clone(&self) -> Au
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Ord for Au
[src]
impl Ord for Au
fn cmp(&self, other: &Au) -> Ordering
[src]
fn cmp(&self, other: &Au) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Copy for Au
[src]
impl Copy for Au
impl Eq for Au
[src]
impl Eq for Au
impl Debug for Au
[src]
impl Debug for Au
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Sub<Au> for Au
[src]
impl Sub<Au> for Au
type Output = Au
The resulting type after applying the -
operator.
fn sub(self, other: Au) -> Au
[src]
fn sub(self, other: Au) -> Au
Performs the -
operation.
impl Add<Au> for Au
[src]
impl Add<Au> for Au
type Output = Au
The resulting type after applying the +
operator.
fn add(self, other: Au) -> Au
[src]
fn add(self, other: Au) -> Au
Performs the +
operation.
impl Mul<Au> for i32
[src]
impl Mul<Au> for i32
type Output = Au
The resulting type after applying the *
operator.
fn mul(self, other: Au) -> Au
[src]
fn mul(self, other: Au) -> Au
Performs the *
operation.
impl Mul<i32> for Au
[src]
impl Mul<i32> for Au
type Output = Au
The resulting type after applying the *
operator.
fn mul(self, other: i32) -> Au
[src]
fn mul(self, other: i32) -> Au
Performs the *
operation.
impl Div<Au> for Au
[src]
impl Div<Au> for Au
type Output = i32
The resulting type after applying the /
operator.
fn div(self, other: Au) -> i32
[src]
fn div(self, other: Au) -> i32
Performs the /
operation.
impl Div<i32> for Au
[src]
impl Div<i32> for Au
type Output = Au
The resulting type after applying the /
operator.
fn div(self, other: i32) -> Au
[src]
fn div(self, other: i32) -> Au
Performs the /
operation.
impl Rem<Au> for Au
[src]
impl Rem<Au> for Au
type Output = Au
The resulting type after applying the %
operator.
fn rem(self, other: Au) -> Au
[src]
fn rem(self, other: Au) -> Au
Performs the %
operation.
impl Rem<i32> for Au
[src]
impl Rem<i32> for Au
type Output = Au
The resulting type after applying the %
operator.
fn rem(self, other: i32) -> Au
[src]
fn rem(self, other: i32) -> Au
Performs the %
operation.
impl Neg for Au
[src]
impl Neg for Au
type Output = Au
The resulting type after applying the -
operator.
fn neg(self) -> Au
[src]
fn neg(self) -> Au
Performs the unary -
operation.
impl AddAssign<Au> for Au
[src]
impl AddAssign<Au> for Au
fn add_assign(&mut self, other: Au)
[src]
fn add_assign(&mut self, other: Au)
Performs the +=
operation.
impl SubAssign<Au> for Au
[src]
impl SubAssign<Au> for Au
fn sub_assign(&mut self, other: Au)
[src]
fn sub_assign(&mut self, other: Au)
Performs the -=
operation.
impl MulAssign<i32> for Au
[src]
impl MulAssign<i32> for Au
fn mul_assign(&mut self, other: i32)
[src]
fn mul_assign(&mut self, other: i32)
Performs the *=
operation.
impl DivAssign<i32> for Au
[src]
impl DivAssign<i32> for Au
fn div_assign(&mut self, other: i32)
[src]
fn div_assign(&mut self, other: i32)
Performs the /=
operation.
impl Hash for Au
[src]
impl Hash for Au
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &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[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Zero for Au
[src]
impl Zero for Au
fn zero() -> Au
[src]
fn zero() -> Au
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
[src]
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl Serialize for Au
[src]
impl Serialize for Au
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>
[src]
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>
Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for Au
[src]
impl<'de> Deserialize<'de> for Au
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Au, D::Error>
[src]
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Au, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,