Skip to main content

without_default

Function without_default 

Source
pub fn without_default(text: &str, mime: &str) -> Option<String>
Expand description

text with mime’s default removed, or None when it had none.

The counterpart to with_default, and under the same rule: one line goes and every other byte is copied through. None rather than an unchanged copy, so a caller can decline to rewrite a file it has nothing to say about — a save that only rewrites the line endings of somebody’s hand-kept file is still a save they did not ask for.

Removing the line rather than setting it to nothing. type= with an empty value is a line every other reader on the desktop has to have an opinion about, and the specification gives it none.

Every line for the type in that section, not the first. A repeated key accumulates here (see parse_section), so leaving one behind would mean a cleared default that is still set — the failure being cleared in the first place.

Only [Default Applications]. An association a person added is a different statement and is not theirs to lose because a default was cleared.