{"id":20089904,"url":"https://github.com/bugadani/yaum","last_synced_at":"2025-03-02T15:23:34.747Z","repository":{"id":57672710,"uuid":"262350572","full_name":"bugadani/yaum","owner":"bugadani","description":"Yet Another Units of Measurement library","archived":false,"fork":false,"pushed_at":"2020-06-23T07:05:33.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-13T02:43:09.328Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bugadani.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-08T14:51:47.000Z","updated_at":"2020-06-23T07:05:36.000Z","dependencies_parsed_at":"2022-08-31T11:14:14.053Z","dependency_job_id":null,"html_url":"https://github.com/bugadani/yaum","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugadani%2Fyaum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugadani%2Fyaum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugadani%2Fyaum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugadani%2Fyaum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bugadani","download_url":"https://codeload.github.com/bugadani/yaum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241079815,"owners_count":19906134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T16:20:43.155Z","updated_at":"2025-03-02T15:23:34.717Z","avatar_url":"https://github.com/bugadani.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Yet Another Units of Measurement library [![crates.io](https://img.shields.io/crates/v/yaum.svg)](https://crates.io/crates/yaum)\n========================================\n\nThis crate provides type-safe basic scientific units and constants for `no_std` programs.\n\n[Documentation](https://docs.rs/yaum/)\n\nExample\n-------\n\n```rust\nuse yaum::time::*;\nuse yaum::length::*;\nuse yaum::velocity::*;\n\n// Simple arithmetic\nassert_eq!(1.0 * kph, 1.0 * km / h);\nassert_eq!(1.0 * km / min, 60.0 * km / h);\n\n// Read value in a given unit\nassert_eq!(60.0, (1.0 * min).s());\nassert_eq!(1_000.0, (1.0 * km).m());\n```\n\nCurrently supported units:\n* `time`: Time\n* `angle`: Angle, angular speed\n* `frequency`: Frequency, sampling frequency\n* `length`: Length\n* `velocity`: Velocity, acceleration\n* `electric`: Current, Voltage, Resistance\n\nDefine custom units and conversions using the `impl_unit!`, `convert_div!` and `convert_unit!` macros.\n\n```rust\n# #[macro_use] extern crate yaum;\nuse yaum::*;\nuse yaum::time::*;\n\nyaum::impl_unit!(ByteSize, {\n    B: 1.0,\n    kB: 1024.0,\n    MB: 1024.0 * 1024.0\n});\nyaum::impl_unit!(BitSize, {\n    b: 1.0,\n    kb: 1024.0,\n    Mb: 1024.0 * 1024.0\n});\n\n// define conversion between the two units (1 byte = 8 bits):\nyaum::convert_unit!(ByteSize, BitSize, 8.0);\n\nyaum::impl_unit!(BitSpeed, {\n    bps: 1.0,\n    kbps: 1024.0,\n    Mbps: 1024.0 * 1024.0\n});\n\n// define relationship between units (BitSpeed = BitSize/Time)\nyaum::convert_div!(BitSize, Time, BitSpeed);\n\nfn main() {\n    assert_eq!(8.0 * b, (1.0 * B).into());\n    assert_eq!(1.0 * kbps, 1.0 * kb/s);\n}\n```\n\nPrecision\n---------\n\nBy default, units are implemented on top of `f32`. Enable the `double_precision` feature for `f64`.\n\n```TOML\n[dependencies.yaum]\nversion = \"0.1.0\"\ndefault-features = false\nfeatures = [\"double_precision\"]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugadani%2Fyaum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbugadani%2Fyaum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugadani%2Fyaum/lists"}