Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Quick Greek Yogurt with Walnuts and Raspberries

A fast, no-cook ketogenic snack designed for maximum efficiency. This bowl balances the high-protein content of Greek yogurt with the dense healthy fats of walnuts to provide sustained energy until dinner.

Ingredients (Per Serving)

  • 150g Full-fat Greek Yogurt (5% fat, plain/unsweetened) - about 2/3 cup
  • 21g Walnut halves - about 7 halves, or a small handful
  • 25g Fresh Raspberries - about 8-10 berries

Preparation Steps

Mix joghurt, walnut, and raspberries.

Nutritional Values (per 100g)

Reference values from nutrition labels:

IngredientKcalProteinFatNet Carbs
Greek Yogurt (5%)938.7g5.0g3.3g
Walnuts66515.0g65.0g5.0g
Raspberries271.25g0.25g5.0g

Recipe Breakdown (actual amounts)

IngredientAmountKcalProteinFatNet Carbs
Greek Yogurt (5%)150g14013.0g7.5g5.0g
Walnuts21g1403.2g13.7g1.1g
Raspberries25g70.3g0.1g1.3g
TOTAL28616.5g21.2g7.3g
Target30015.0g23.0g8.0g
Diff-14+1.5g-1.8g-0.7g
Diff %-5%+10%-8%-9%

Interactive Calculator

Modify the values below if your ingredients have different nutritional content, then run to check if the meal still hits your targets. See mdBook Rust Integration for details.

// Kcal per gram of each macronutrient
const KCAL_PER_G_PROTEIN: f64 = 4.0;
const KCAL_PER_G_CARBS: f64 = 4.0;
const KCAL_PER_G_FAT: f64 = 9.0;

struct Ingredient {
    name: &'static str,
    grams: f64,
    // Nutritional values per 100g:
    protein_per_100g: f64,
    fat_per_100g: f64,
    carbs_per_100g: f64,
}

fn main() {
    // === TARGET VALUES (edit these) ===
    let target_kcal = 300.0;
    let target_protein = 15.0;
    let target_fat = 23.0;
    let target_carbs = 8.0;
    
    // === TOLERANCE (how far off is acceptable, in %) ===
    let kcal_over_pct = 12.5;
    let kcal_under_pct = 12.5;
    let protein_over_pct = 12.5;
    let protein_under_pct = 12.5;
    let fat_over_pct = 12.5;
    let fat_under_pct = 12.5;
    let carbs_over_pct = 12.5;
    let carbs_under_pct = 12.5;
    
    // === INGREDIENTS (edit nutritional values per 100g) ===
    // Note: kcal is calculated automatically (protein*4 + carbs*4 + fat*9)
    let ingredients = vec![
        Ingredient {
            name: "Greek Yogurt (5%)",
            grams: 150.0,
            protein_per_100g: 8.7,
            fat_per_100g: 5.0,
            carbs_per_100g: 3.3,
        },
        Ingredient {
            name: "Walnuts",
            grams: 21.0,
            protein_per_100g: 15.0,
            fat_per_100g: 65.0,
            carbs_per_100g: 5.0,
        },
        Ingredient {
            name: "Raspberries",
            grams: 25.0,
            protein_per_100g: 1.25,
            fat_per_100g: 0.25,
            carbs_per_100g: 5.0,
        },
    ];
    
    // === CALCULATION (no need to edit below) ===
    let mut total_kcal = 0.0;
    let mut total_protein = 0.0;
    let mut total_fat = 0.0;
    let mut total_carbs = 0.0;
    
    println!("INGREDIENT BREAKDOWN");
    println!("{:-<75}", "");
    
    for ing in &ingredients {
        let mult = ing.grams / 100.0;
        let ing_protein = ing.protein_per_100g * mult;
        let ing_fat = ing.fat_per_100g * mult;
        let ing_carbs = ing.carbs_per_100g * mult;
        let ing_kcal = (ing_protein * KCAL_PER_G_PROTEIN) 
                     + (ing_carbs * KCAL_PER_G_CARBS) 
                     + (ing_fat * KCAL_PER_G_FAT);
        
        total_kcal += ing_kcal;
        total_protein += ing_protein;
        total_fat += ing_fat;
        total_carbs += ing_carbs;
        
        println!("{:<20} {:>5.0}g | {:>5.0} kcal | {:>5.1}g P | {:>5.1}g F | {:>5.1}g C",
            ing.name, ing.grams, ing_kcal, ing_protein, ing_fat, ing_carbs);
    }
    
    println!("{:-<75}", "");
    println!("{:<20} {:>6} | {:>5.0} kcal | {:>5.1}g P | {:>5.1}g F | {:>5.1}g C",
        "TOTAL", "", total_kcal, total_protein, total_fat, total_carbs);
    println!("{:<20} {:>6} | {:>5.0} kcal | {:>5.1}g P | {:>5.1}g F | {:>5.1}g C",
        "TARGET", "", target_kcal, target_protein, target_fat, target_carbs);
    
    println!("\n{:-<75}", "");
    println!("VERDICT");
    println!("{:-<75}", "");
    
    let kcal_ok = total_kcal <= target_kcal * (1.0 + kcal_over_pct / 100.0)
               && total_kcal >= target_kcal * (1.0 - kcal_under_pct / 100.0);
    let protein_ok = total_protein <= target_protein * (1.0 + protein_over_pct / 100.0)
                  && total_protein >= target_protein * (1.0 - protein_under_pct / 100.0);
    let fat_ok = total_fat <= target_fat * (1.0 + fat_over_pct / 100.0)
              && total_fat >= target_fat * (1.0 - fat_under_pct / 100.0);
    let carbs_ok = total_carbs <= target_carbs * (1.0 + carbs_over_pct / 100.0)
                && total_carbs >= target_carbs * (1.0 - carbs_under_pct / 100.0);
    
    let kcal_diff = total_kcal - target_kcal;
    let kcal_diff_pct = (kcal_diff / target_kcal) * 100.0;
    let kcal_status = if kcal_ok { "OK" } else if kcal_diff > 0.0 { "HIGH" } else { "LOW" };
    println!("Kcal:    {} ({:.0} / {:.0}, {:+.0} kcal, {:+.0}%)", 
        kcal_status, total_kcal, target_kcal, kcal_diff, kcal_diff_pct);
    
    let protein_diff = total_protein - target_protein;
    let protein_diff_pct = (protein_diff / target_protein) * 100.0;
    let protein_status = if protein_ok { "OK" } else if protein_diff > 0.0 { "HIGH" } else { "LOW" };
    println!("Protein: {} ({:.1}g / {:.1}g, {:+.1}g, {:+.0}%)", 
        protein_status, total_protein, target_protein, protein_diff, protein_diff_pct);
    
    let fat_diff = total_fat - target_fat;
    let fat_diff_pct = (fat_diff / target_fat) * 100.0;
    let fat_status = if fat_ok { "OK" } else if fat_diff > 0.0 { "HIGH" } else { "LOW" };
    println!("Fat:     {} ({:.1}g / {:.1}g, {:+.1}g, {:+.0}%)", 
        fat_status, total_fat, target_fat, fat_diff, fat_diff_pct);
    
    let carbs_diff = total_carbs - target_carbs;
    let carbs_diff_pct = (carbs_diff / target_carbs) * 100.0;
    let carbs_status = if carbs_ok { "OK" } else if carbs_diff > 0.0 { "HIGH" } else { "LOW" };
    println!("Carbs:   {} ({:.1}g / {:.1}g, {:+.1}g, {:+.0}%)", 
        carbs_status, total_carbs, target_carbs, carbs_diff, carbs_diff_pct);
    
    if kcal_ok && protein_ok && fat_ok && carbs_ok {
        println!("\nāœ“ This meal hits all targets!");
    } else {
        println!("\nāœ— Issues:");
        if !kcal_ok {
            let diff = total_kcal - target_kcal;
            let pct = (diff / target_kcal) * 100.0;
            if diff > 0.0 {
                println!("  - Kcal too high: {:.0} over ({:+.0}%)", diff, pct);
            } else {
                println!("  - Kcal too low: {:.0} under ({:-.0}%)", -diff, pct);
            }
        }
        if !protein_ok {
            let diff = total_protein - target_protein;
            let pct = (diff / target_protein) * 100.0;
            if diff > 0.0 {
                println!("  - Protein too high: {:.1}g over ({:+.0}%)", diff, pct);
            } else {
                println!("  - Protein too low: {:.1}g under ({:-.0}%)", -diff, pct);
            }
        }
        if !fat_ok {
            let diff = total_fat - target_fat;
            let pct = (diff / target_fat) * 100.0;
            if diff > 0.0 {
                println!("  - Fat too high: {:.1}g over ({:+.0}%)", diff, pct);
            } else {
                println!("  - Fat too low: {:.1}g under ({:-.0}%)", -diff, pct);
            }
        }
        if !carbs_ok {
            let diff = total_carbs - target_carbs;
            let pct = (diff / target_carbs) * 100.0;
            if diff > 0.0 {
                println!("  - Carbs too high: {:.1}g over ({:+.0}%)", diff, pct);
            } else {
                println!("  - Carbs too low: {:.1}g under ({:-.0}%)", -diff, pct);
            }
        }
    }
}