pub struct CP861;Implementations§
Source§impl CP861
impl CP861
Sourcepub fn decode(self, bytes: &[u8]) -> Cow<'_, str>
pub fn decode(self, bytes: &[u8]) -> Cow<'_, str>
Decode CP861 byte-encoding into UTF-8 string
§Examples
use yore::code_pages::CP861;
assert_eq!(CP861.decode(&[116, 101, 120, 116]), "text");Sourcepub fn encode(self, s: &str) -> Result<Cow<'_, [u8]>, EncodeError>
pub fn encode(self, s: &str) -> Result<Cow<'_, [u8]>, EncodeError>
Encode UTF-8 string into CP861 byte-encoding
Undefined characters will result in EncodeError
§Examples
use yore::code_pages::CP861;
use yore::EncodeError;
assert_eq!(CP861.encode("text").unwrap(), vec![116, 101, 120, 116]);
assert!(matches!(CP861.encode("text 🦀"), EncodeError));Trait Implementations§
Source§impl CodePage for CP861
impl CodePage for CP861
Source§fn decode<'a>(&self, bytes: &'a [u8]) -> Result<Cow<'a, str>, DecodeError>
fn decode<'a>(&self, bytes: &'a [u8]) -> Result<Cow<'a, str>, DecodeError>
Decode single-byte encoding into UTF-8 string Read more
Source§fn encode<'a>(&self, s: &'a str) -> Result<Cow<'a, [u8]>, EncodeError>
fn encode<'a>(&self, s: &'a str) -> Result<Cow<'a, [u8]>, EncodeError>
Encode UTF-8 string into single-byte encoding Read more
Source§fn encode_lossy<'a>(&self, s: &'a str, fallback: u8) -> Cow<'a, [u8]>
fn encode_lossy<'a>(&self, s: &'a str, fallback: u8) -> Cow<'a, [u8]>
Encode UTF-8 string into single-byte encoding Read more
impl Copy for CP861
Auto Trait Implementations§
impl Freeze for CP861
impl RefUnwindSafe for CP861
impl Send for CP861
impl Sync for CP861
impl Unpin for CP861
impl UnwindSafe for CP861
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