Skip to main content

upsert

Function upsert 

Source
pub fn upsert(contents: &str, section: &str) -> Result<String>
Expand description

Replaces the managed section in contents, or appends one.

Everything outside the markers is preserved byte for byte. A file with an opening marker and no closing one is refused rather than guessed at: guessing the boundary would destroy the user’s own attributes.

§Errors

Error::Config when the markers are unbalanced.