Skip to main content

change_health

Function change_health 

Source
fn change_health<R>(
    change: impl FnOnce(&mut Health) -> Result<R, String>,
) -> Result<R, String>
Expand description

The health file read, changed by change and written back, all under its lock, which the sharing takes too: a change is set over the medicines as the file holds them then (Health::change), never over a copy read earlier.