pub struct LayoutUnit(pub i32);Expand description
Fixed-point 1/64th pixel scalar coordinate (Chromium Blink LayoutUnit parity).
Tuple Fields§
§0: i32Implementations§
Source§impl LayoutUnit
impl LayoutUnit
pub const SCALE: f32 = 64.0
pub const ZERO: LayoutUnit
pub fn from_f32(val: f32) -> LayoutUnit
pub fn to_f32(self) -> f32
Sourcepub fn snap_to_device_grid(self, dpr: f32) -> f32
pub fn snap_to_device_grid(self, dpr: f32) -> f32
Snaps coordinate to physical device grid based on Device Pixel Ratio (DPR).
Sourcepub fn snap_border(self, dpr: f32) -> f32
pub fn snap_border(self, dpr: f32) -> f32
Chromium border snapping formula: guarantees at least 1 physical pixel width.
Trait Implementations§
Source§impl Add for LayoutUnit
impl Add for LayoutUnit
Source§type Output = LayoutUnit
type Output = LayoutUnit
The resulting type after applying the
+ operator.Source§fn add(self, rhs: LayoutUnit) -> <LayoutUnit as Add>::Output
fn add(self, rhs: LayoutUnit) -> <LayoutUnit as Add>::Output
Performs the
+ operation. Read moreSource§impl Clone for LayoutUnit
impl Clone for LayoutUnit
Source§fn clone(&self) -> LayoutUnit
fn clone(&self) -> LayoutUnit
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for LayoutUnit
Source§impl Debug for LayoutUnit
impl Debug for LayoutUnit
Source§impl Default for LayoutUnit
impl Default for LayoutUnit
Source§fn default() -> LayoutUnit
fn default() -> LayoutUnit
Returns the “default value” for a type. Read more
Source§impl Div<i32> for LayoutUnit
impl Div<i32> for LayoutUnit
impl Eq for LayoutUnit
Source§impl Hash for LayoutUnit
impl Hash for LayoutUnit
Source§impl Mul<i32> for LayoutUnit
impl Mul<i32> for LayoutUnit
Source§impl Ord for LayoutUnit
impl Ord for LayoutUnit
Source§fn cmp(&self, other: &LayoutUnit) -> Ordering
fn cmp(&self, other: &LayoutUnit) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for LayoutUnit
impl PartialEq for LayoutUnit
Source§impl PartialOrd for LayoutUnit
impl PartialOrd for LayoutUnit
impl StructuralPartialEq for LayoutUnit
Source§impl Sub for LayoutUnit
impl Sub for LayoutUnit
Source§type Output = LayoutUnit
type Output = LayoutUnit
The resulting type after applying the
- operator.Source§fn sub(self, rhs: LayoutUnit) -> <LayoutUnit as Sub>::Output
fn sub(self, rhs: LayoutUnit) -> <LayoutUnit as Sub>::Output
Performs the
- operation. Read moreAuto Trait Implementations§
impl Forget for LayoutUnit
impl Freeze for LayoutUnit
impl Move for LayoutUnit
impl RefUnwindSafe for LayoutUnit
impl Send for LayoutUnit
impl Sync for LayoutUnit
impl Unpin for LayoutUnit
impl UnsafeUnpin for LayoutUnit
impl UnwindSafe for LayoutUnit
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.