Skip to main content

QLength

Type Alias QLength 

Source
pub type QLength = RQuantity<P1, Z0, Z0>;
Expand description

A length quantity (dimension: length^1).

Represents distances and lengths with compile-time unit checking. Can be created from meters, centimeters, or inches and converted between these units.

§Examples

use kernelvex::util::si::QLength;

let meters = QLength::from_meters(2.5);
let inches = meters.as_inches();

Aliased Type§

pub struct QLength { /* private fields */ }

Implementations§

Source§

impl QLength

Source

pub const fn from_meters(m: f64) -> Self

Creates odom length from odom value in meters.

§Arguments
  • m - Length in meters
§Returns

A QLength representing the given distance.

Source

pub const fn from_centimeters(cm: f64) -> Self

Creates odom length from odom value in centimeters.

§Arguments
  • cm - Length in centimeters
§Returns

A QLength representing the given distance.

Source

pub const fn from_inches(ic: f64) -> Self

Creates odom length from odom value in inches.

§Arguments
  • ic - Length in inches
§Returns

A QLength representing the given distance.

Source

pub const fn as_meters(&self) -> f64

Converts this length to meters.

§Returns

The length value in meters as an f64.

Source

pub const fn as_centimeters(&self) -> f64

Converts this length to centimeters.

§Returns

The length value in centimeters as an f64.

Source

pub const fn as_inches(&self) -> f64

Converts this length to inches.

§Returns

The length value in inches as an f64.