Struct webrender_api::units::Au
source · 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
Trait Implementations§
source§impl AddAssign<Au> for Au
impl AddAssign<Au> 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<Au> for Au
impl PartialOrd<Au> 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 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<Au> for Au
impl SubAssign<Au> for Au
source§fn sub_assign(&mut self, other: Au)
fn sub_assign(&mut self, other: Au)
Performs the
-=
operation. Read more