pub enum OpenEncodingPolicy {
Utf8FastPath,
AutoDetect,
Reinterpret(DocumentEncoding),
}Expand description
Open policy for choosing between the UTF-8 mmap fast path, initial BOM-backed detection, or an explicit reinterpretation encoding.
Variants§
Utf8FastPath
Keep the existing UTF-8/ASCII mmap fast path and its current semantics.
AutoDetect
Detect BOM-backed encodings on open and otherwise fall back to the normal UTF-8/ASCII fast path.
This first detection slice intentionally avoids heavyweight legacy charset guessing so open-time cost stays predictable.
Reinterpret(DocumentEncoding)
Reinterpret the source bytes through the requested encoding.
This is the option to use for legacy encodings such as
windows-1251, Shift_JIS, or GB18030 when the caller already knows
the intended source encoding.
Trait Implementations§
Source§impl Clone for OpenEncodingPolicy
impl Clone for OpenEncodingPolicy
Source§fn clone(&self) -> OpenEncodingPolicy
fn clone(&self) -> OpenEncodingPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OpenEncodingPolicy
impl Debug for OpenEncodingPolicy
Source§impl Default for OpenEncodingPolicy
impl Default for OpenEncodingPolicy
Source§fn default() -> OpenEncodingPolicy
fn default() -> OpenEncodingPolicy
Returns the “default value” for a type. Read more
Source§impl Hash for OpenEncodingPolicy
impl Hash for OpenEncodingPolicy
Source§impl PartialEq for OpenEncodingPolicy
impl PartialEq for OpenEncodingPolicy
impl Copy for OpenEncodingPolicy
impl Eq for OpenEncodingPolicy
impl StructuralPartialEq for OpenEncodingPolicy
Auto Trait Implementations§
impl Freeze for OpenEncodingPolicy
impl RefUnwindSafe for OpenEncodingPolicy
impl Send for OpenEncodingPolicy
impl Sync for OpenEncodingPolicy
impl Unpin for OpenEncodingPolicy
impl UnsafeUnpin for OpenEncodingPolicy
impl UnwindSafe for OpenEncodingPolicy
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
Mutably borrows from an owned value. Read more