pub enum Encoding {
Utf8,
Utf16,
Utf16Le,
Utf16Be,
}Expand description
Supported explicit text encodings. All decoding is strict.
Variants§
Implementations§
Source§impl Encoding
impl Encoding
Sourcepub fn decode(self, bytes: &[u8]) -> Result<String>
pub fn decode(self, bytes: &[u8]) -> Result<String>
Decode bytes, consuming a matching BOM and rejecting malformed data.
Utf16 requires a BOM; endian-specific variants also accept headerless
data, but reject a contradictory BOM. Generic Utf16 rejects ambiguous
UTF-32 signatures; select an endian explicitly for BOM + leading NUL.
Newline policy belongs to callers.
Trait Implementations§
impl Copy for Encoding
impl Eq for Encoding
impl StructuralPartialEq for Encoding
Auto Trait Implementations§
impl Freeze for Encoding
impl RefUnwindSafe for Encoding
impl Send for Encoding
impl Sync for Encoding
impl Unpin for Encoding
impl UnsafeUnpin for Encoding
impl UnwindSafe for Encoding
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.