#[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!
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) -> Au
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) -> Au
pub fn max_assign(&mut self, other: Au)
pub fn min_assign(&mut self, other: Au)
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: D,
) -> Result<Au, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
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 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 MallocSizeOf for Au
impl MallocSizeOf for Au
Source§fn size_of(&self, _: &mut MallocSizeOfOps) -> usize
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 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
Source§impl Serialize for Au
impl Serialize for Au
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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 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