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
impl Copy for EscapePolicy
impl StructuralPartialEq for EscapePolicy
Auto Trait Implementations§
impl Freeze for EscapePolicy
impl RefUnwindSafe for EscapePolicy
impl Send for EscapePolicy
impl Sync for EscapePolicy
impl Unpin for EscapePolicy
impl UnwindSafe for EscapePolicy
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)