Skip to main content

edit

Function edit 

Source
pub fn edit<T>(
    path: &Path,
    f: impl FnOnce(&mut DocumentMut) -> T,
) -> Result<T, Box<dyn Error>>
Expand description

Applies f to the file under an exclusive lock, so two commands editing it at once do not lose a change. The result is checked before it is written; a missing file starts empty.