Skip to main content

save_merged

Function save_merged 

Source
pub fn save_merged<T: Serialize + DeserializeOwned>(
    path: &Path,
    read: &Read,
    state: &T,
) -> Result<(), String>
Expand description

state written into path, under its lock, the file read again first: what changed from read (the file as it was read) to state is set over what the file holds now, field by field (a list as a set: what was added added, what was taken out taken out; a list or table missing on one side is an empty one, as a state skips an empty field); the rest stays as the file holds it. A file missing when it was read is read as empty. Nothing read before that could be merged (a file that did not read): state whole. Written beside, then moved.