unitscale 0.2.0

Facade crate for statically-scaled unit macros and traits.
Documentation
// Copyright 2025 GooseGrid Technologies
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! # SI prefixes
//!
//! Common SI prefixes as `UnitScale` for convenience.

pub mod f32 {
    use crate::prelude::unit_scale;

    /// Prefix for `1E15`
    #[unit_scale(to = 1e15)]
    pub struct Peta;

    /// Prefix for `1E12`
    #[unit_scale(to = 1e12)]
    pub struct Tera;

    /// Prefix for `1E9`
    #[unit_scale(to = 1e9)]
    pub struct Giga;

    /// Prefix for `1E6`
    #[unit_scale(to = 1e6)]
    pub struct Mega;

    /// Prefix for `1E3`
    #[unit_scale(to = 1e3)]
    pub struct Kilo;

    /// Prefix for `1E2`
    #[unit_scale(to = 1e2)]
    pub struct Hecto;

    /// Prefix for `1E1`
    #[unit_scale(to = 1e1)]
    pub struct Deka;

    /// Prefix for `Base scale 1.0`
    #[unit_scale(to = 1e0)]
    pub struct Base;

    /// Prefix for `1E-1`
    #[unit_scale(to = 1e-1)]
    pub struct Deci;

    /// Prefix for `1E-2`
    #[unit_scale(to = 1e-2)]
    pub struct Centi;

    /// Prefix for `1E-3`
    #[unit_scale(to = 1e-3)]
    pub struct Milli;

    /// Prefix for `1E-6`
    #[unit_scale(to = 1e-6)]
    pub struct Micro;

    /// Prefix for `1E-9`
    #[unit_scale(to = 1e-9)]
    pub struct Nano;

    /// Prefix for `1E-12`
    #[unit_scale(to = 1e-12)]
    pub struct Pico;

    /// Prefix for `1E-15`
    #[unit_scale(to = 1e-15)]
    pub struct Femto;
}

pub mod f64 {
    use crate::prelude::unit_scale;

    /// Prefix for `1E15`
    #[unit_scale(to = 1e15, with = "f64")]
    pub struct Peta;

    /// Prefix for `1E12`
    #[unit_scale(to = 1e12, with = "f64")]
    pub struct Tera;

    /// Prefix for `1E9`
    #[unit_scale(to = 1e9, with = "f64")]
    pub struct Giga;

    /// Prefix for `1E6`
    #[unit_scale(to = 1e6, with = "f64")]
    pub struct Mega;

    /// Prefix for `1E3`
    #[unit_scale(to = 1e3, with = "f64")]
    pub struct Kilo;

    /// Prefix for `1E2`
    #[unit_scale(to = 1e2, with = "f64")]
    pub struct Hecto;

    /// Prefix for `1E1`
    #[unit_scale(to = 1e1, with = "f64")]
    pub struct Deka;

    /// Prefix for `Base scale 1.0`
    #[unit_scale(to = 1e0, with = "f64")]
    pub struct Base;

    /// Prefix for `1E-1`
    #[unit_scale(to = 1e-1, with = "f64")]
    pub struct Deci;

    /// Prefix for `1E-2`
    #[unit_scale(to = 1e-2, with = "f64")]
    pub struct Centi;

    /// Prefix for `1E-3`
    #[unit_scale(to = 1e-3, with = "f64")]
    pub struct Milli;

    /// Prefix for `1E-6`
    #[unit_scale(to = 1e-6, with = "f64")]
    pub struct Micro;

    /// Prefix for `1E-9`
    #[unit_scale(to = 1e-9, with = "f64")]
    pub struct Nano;

    /// Prefix for `1E-12`
    #[unit_scale(to = 1e-12, with = "f64")]
    pub struct Pico;

    /// Prefix for `1E-15`
    #[unit_scale(to = 1e-15, with = "f64")]
    pub struct Femto;
}