Crates.io | percent-rs |
lib.rs | percent-rs |
version | 0.1.1 |
source | src |
created_at | 2024-07-04 15:55:37.669321 |
updated_at | 2024-07-23 19:22:04.849232 |
description | Simple crate for percentages of integers and floats |
homepage | |
repository | https://github.com/ontometrics/percent-rs |
max_upload_size | |
id | 1291788 |
size | 8,069 |
Simple implementation of a percentage that you can add, subtract, multiply, and divide.
use percent_rs::Percentage;
fn main() {
let percent = Percentage::from(50);
let percent_decimal = Percentage::from_decimal(50.5);
println!("{}", percent); // 50%
println!("{}", percent_decimal); // 55.5%
}