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: Self
pub fn from_f32(val: f32) -> Self
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§impl Clone for LayoutUnit
impl Clone for LayoutUnit
impl Copy for LayoutUnit
Source§impl Debug for LayoutUnit
impl Debug for LayoutUnit
Source§impl Default for LayoutUnit
impl Default for LayoutUnit
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
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
Auto 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