| Crates.io | diet-calc |
| lib.rs | diet-calc |
| version | 0.1.3 |
| created_at | 2025-04-11 18:14:36.045136+00 |
| updated_at | 2025-04-11 18:46:38.673858+00 |
| description | Fundamental algorithms for dietetics computing in Rust |
| homepage | https://github.com/mycotoxin/diet-calc |
| repository | https://github.com/mycotoxin/diet-calc |
| max_upload_size | |
| id | 1630109 |
| size | 20,845 |
diet-calc is a Rust library that allows users to calculate key nutritional and health metrics:
These metrics assist dietitians and health-conscious individuals in assessing body composition and daily caloric requirements.
BMI categories according to the World Health Organization (WHO):
BMR calculated using the Mifflin-St Jeor equation (Mifflin et al., 1990):
TDEE is BMR multiplied by an activity factor (source)
WHtR values >0.5 indicate increased cardiovascular and metabolic risk (Browning et al., 2010).
BAI estimates body fat percentage:
Formula from Bergman et al., 2011.
Clone, build, and run the project:
git clone https://github.com/mycotoxin/diet-calc.git
cd diet-calc
cargo build --release
use diet_calc::formulas::bmi;
use uom::si::f32::{ Length, Mass};
use uom::si::length::centimeter;
use uom::si::mass::kilogram;
fn main() {
let bmi: f32 = bmi(Mass::new::<kilogram>(70.0), Length::new::<centimeter>(184.0)).unwrap();
println!("BMR Result is: {} ", bmi);
}
This project is licensed under the MIT License. See the LICENSE file for details.