pub enum OpenEncodingPolicy {
Utf8FastPath,
AutoDetect,
AutoDetectOrReinterpret(DocumentEncoding),
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.
AutoDetectOrReinterpret(DocumentEncoding)
Detect BOM-backed encodings first and otherwise reinterpret the source through the requested fallback encoding.
This keeps the cheap BOM-backed detection path while still letting a caller say “if you do not detect anything stronger, use this explicit encoding instead of plain UTF-8 fast-path behavior”.
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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more