#[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!
fn clamp(self) -> Self
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) -> Self
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) -> Self
pub fn max_assign(&mut self, other: Self)
pub fn min_assign(&mut self, other: Self)
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<'de> Deserialize<'de> for Au
impl<'de> Deserialize<'de> for Au
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Au, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Au, D::Error>
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 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
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moresource§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 moreimpl 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