sity

Crates.iosity
lib.rssity
version0.9.3
sourcesrc
created_at2024-10-09 09:38:10.612889
updated_at2024-10-30 15:18:57.698318
descriptionInternational System of Units (SI) Typing
homepage
repositoryhttps://github.com/DavidD12/sity
max_upload_size
id1402212
size180,341
(DavidD12)

documentation

README

SITY for SI (Intenational System Unit) Typing

This library makes SI types available in Rust. International System Conformance is checked at compile time.

Example

pub use sity::*;
use std::mem;

fn main() {
    let a = centi_metre(3.0);
    let b = centi_metre(4.0);
    let c = second(2.0);
    let si_value = a * b / c;
    let si_value_size = mem::size_of_val(&si_value);
    // let x = a + c; // Compile time Error

    println!("si_value = {} (size = {})", si_value, si_value_size);
    let pure_value = si_value.value();
    let pure_value_size = mem::size_of_val(&pure_value);
    println!("pure_value = {} (size = {})", pure_value, pure_value_size);    
}
Commit count: 27

cargo fmt