pub enum Encoder {
Hex,
Base64,
Windows1252,
Latin1,
Ascii,
Utf8,
Utf16le,
Utf16be,
}Variants§
Hex
Base64
Windows1252
WHATWG windows-1252: bytes 0x80-0x9F carry the punctuation
block, everything else is Latin-1. What TextDecoder uses for
this label family.
Latin1
Node’s latin1 / binary Buffer encoding: byte value IS the
code point, and encoding truncates anything above U+00FF.
Ascii
Node’s ascii Buffer encoding, which MASKS the high bit rather
than treating the byte as Latin-1.
Utf8
Utf16le
Utf16be
Implementations§
Source§impl Encoder
impl Encoder
pub fn from_optional_str(encoding: Option<&str>) -> Result<Self, String>
Sourcepub fn from_web_label(label: &str) -> Result<Self, String>
pub fn from_web_label(label: &str) -> Result<Self, String>
A WHATWG Encoding Standard label, as TextDecoder takes.
Sourcepub fn from_optional_web_label(label: Option<&str>) -> Result<Self, String>
pub fn from_optional_web_label(label: Option<&str>) -> Result<Self, String>
A WHATWG label, defaulting to UTF-8 when absent or empty.
pub fn encode_to_string( &self, bytes: &[u8], lossy: bool, ) -> Result<String, String>
pub fn encode(&self, bytes: &[u8]) -> Result<Vec<u8>, String>
pub fn decode<'a, T: Into<Cow<'a, [u8]>>>( &self, bytes: T, ) -> Result<Vec<u8>, String>
pub fn decode_from_string(&self, string: String) -> Result<Vec<u8>, String>
pub fn as_label(&self) -> &str
Trait Implementations§
impl StructuralPartialEq for Encoder
Auto Trait Implementations§
impl Freeze for Encoder
impl RefUnwindSafe for Encoder
impl Send for Encoder
impl Sync for Encoder
impl Unpin for Encoder
impl UnsafeUnpin for Encoder
impl UnwindSafe for Encoder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more