Skip to main content

UnitExt

Trait UnitExt 

Source
pub trait UnitExt {
    // Required methods
    fn pct(self) -> Pct;
    fn pt(self) -> Pt;
    fn em(self) -> Em;
    fn lh(self) -> Lh;
    fn px(self) -> Pt;
    fn deg(self) -> Angle;
    fn rad(self) -> Angle;
}

Required Methods§

Source

fn pct(self) -> Pct

Create a percentage unit.

The final basis depends on the property being styled.

Source

fn pt(self) -> Pt

Create an absolute Floem point unit.

Floem resolves points in logical view space. The renderer applies the window scale factor later when drawing to the target surface.

Source

fn em(self) -> Em

Create a unit relative to the current element’s computed font size.

Source

fn lh(self) -> Lh

Create a unit relative to the current element’s computed line height.

Source

fn px(self) -> Pt

👎Deprecated:

use .pt() instead

Deprecated alias for UnitExt::pt.

Source

fn deg(self) -> Angle

Create an angle expressed in degrees.

Source

fn rad(self) -> Angle

Create an angle expressed in radians.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl UnitExt for f32

Source§

fn pct(self) -> Pct

Source§

fn pt(self) -> Pt

Source§

fn em(self) -> Em

Source§

fn lh(self) -> Lh

Source§

fn px(self) -> Pt

👎Deprecated:

use .pt() instead

Source§

fn deg(self) -> Angle

Source§

fn rad(self) -> Angle

Source§

impl UnitExt for f64

Source§

fn pct(self) -> Pct

Source§

fn pt(self) -> Pt

Source§

fn em(self) -> Em

Source§

fn lh(self) -> Lh

Source§

fn px(self) -> Pt

👎Deprecated:

use .pt() instead

Source§

fn deg(self) -> Angle

Source§

fn rad(self) -> Angle

Source§

impl UnitExt for i32

Source§

fn pct(self) -> Pct

Source§

fn pt(self) -> Pt

Source§

fn em(self) -> Em

Source§

fn lh(self) -> Lh

Source§

fn px(self) -> Pt

👎Deprecated:

use .pt() instead

Source§

fn deg(self) -> Angle

Source§

fn rad(self) -> Angle

Source§

impl UnitExt for u32

Source§

fn pct(self) -> Pct

Source§

fn pt(self) -> Pt

Source§

fn em(self) -> Em

Source§

fn lh(self) -> Lh

Source§

fn px(self) -> Pt

👎Deprecated:

use .pt() instead

Source§

fn deg(self) -> Angle

Source§

fn rad(self) -> Angle

Source§

impl UnitExt for usize

Source§

fn pct(self) -> Pct

Source§

fn pt(self) -> Pt

Source§

fn em(self) -> Em

Source§

fn lh(self) -> Lh

Source§

fn px(self) -> Pt

👎Deprecated:

use .pt() instead

Source§

fn deg(self) -> Angle

Source§

fn rad(self) -> Angle

Implementors§