Enum ini::EscapePolicy
source · pub enum EscapePolicy {
Nothing,
Basics,
BasicsUnicode,
BasicsUnicodeExtended,
Reserved,
ReservedUnicode,
ReservedUnicodeExtended,
Everything,
}
Expand description
Policies for escaping logic
Variants§
Nothing
Escape absolutely nothing (dangerous)
Basics
Only escape the most necessary things. This means backslashes, control characters (codepoints U+0000 to U+001F), and delete (U+007F). Quotes (single or double) are not escaped.
BasicsUnicode
Escape basics and non-ASCII characters in the Basic Multilingual Plane (i.e. between U+007F - U+FFFF) Codepoints above U+FFFF, e.g. ‘🐱’ U+1F431 “CAT FACE” will not be escaped!
BasicsUnicodeExtended
Escape basics and all non-ASCII characters, including codepoints above U+FFFF. This will escape emoji - if you want them to remain raw, use BasicsUnicode instead.
Reserved
Escape reserved symbols. This includes everything in EscapePolicy::Basics, plus the comment characters ‘;’ and ‘#’ and the key/value-separating characters ‘=’ and ‘:’.
ReservedUnicode
Escape reserved symbols and non-ASCII characters in the BMP. Codepoints above U+FFFF, e.g. ‘🐱’ U+1F431 “CAT FACE” will not be escaped!
ReservedUnicodeExtended
Escape reserved symbols and all non-ASCII characters, including codepoints above U+FFFF.
Everything
Escape everything that some INI implementations assume
Implementations§
source§impl EscapePolicy
impl EscapePolicy
sourcepub fn should_escape(self, c: char) -> bool
pub fn should_escape(self, c: char) -> bool
Given a character this returns true if it should be escaped as per this policy or false if not.
Trait Implementations§
source§impl Clone for EscapePolicy
impl Clone for EscapePolicy
source§fn clone(&self) -> EscapePolicy
fn clone(&self) -> EscapePolicy
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for EscapePolicy
impl Debug for EscapePolicy
source§impl PartialEq for EscapePolicy
impl PartialEq for EscapePolicy
source§fn eq(&self, other: &EscapePolicy) -> bool
fn eq(&self, other: &EscapePolicy) -> bool
self
and other
values to be equal, and is used
by ==
.