absolute_unit/unit/
newtons.rs

1use crate::{ForceUnit, Kilograms, Meters, Seconds, Unit};
2
3#[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOrd)]
4pub struct Newtons;
5impl Unit for Newtons {
6    const UNIT_NAME: &'static str = "newtons";
7    const UNIT_SHORT_NAME: &'static str = "N";
8    const UNIT_SUFFIX: &'static str = "N";
9}
10impl ForceUnit for Newtons {
11    const NEWTONS_IN_UNIT: f64 = 1.0;
12
13    type UnitMass = Kilograms;
14    type UnitLength = Meters;
15    type UnitTime = Seconds;
16}
17
18#[macro_export]
19macro_rules! newtons {
20    ($num:expr) => {
21        $crate::Force::<$crate::Newtons>::from(&$num)
22    };
23}
24
25#[macro_export]
26macro_rules! newton_meters {
27    ($num:expr) => {
28        $crate::Torque::<$crate::Newtons, $crate::Meters>::from(&$num)
29    };
30}