Skip to main content

Crate recipe_ratio

Crate recipe_ratio 

Source
Expand description

§recipe-ratio

Baker’s percentages, dough hydration, and recipe scaling by flour weight. Pure math, no deps. The same ratios behind the IngredientCalculator the cups-to-grams page.

use recipe_ratio::{baker_percent, hydration, scale};
assert!((baker_percent(300.0, 500.0) - 60.0).abs() < 1e-9);  // 300 g water / 500 g flour
assert!((hydration(300.0, 500.0) - 60.0).abs() < 1e-9);
assert!((scale(300.0, 500.0, 1000.0) - 600.0).abs() < 1e-9); // scale water to 1 kg flour

Functions§

baker_percent
Baker’s percentage for an ingredient relative to flour weight (flour = 100%).
dough_weight
Total dough weight = sum of ingredient weights (flour + water + salt + …).
hydration
Dough hydration = water weight / flour weight * 100 (baker’s % of water).
scale
Scale an ingredient weight when flour changes from from_flour to to_flour.