use crate::codec;
use crate::types::*;
#[derive(Clone, Copy)]
pub struct EncoderOnlyUTF8Encoding;
impl Encoding for EncoderOnlyUTF8Encoding {
fn name(&self) -> &'static str {
"encoder-only-utf-8"
}
fn whatwg_name(&self) -> Option<&'static str> {
Some("replacement")
} fn raw_encoder(&self) -> Box<dyn RawEncoder> {
codec::utf_8::UTF8Encoding.raw_encoder()
}
fn raw_decoder(&self) -> Box<dyn RawDecoder> {
codec::error::ErrorEncoding.raw_decoder()
}
}
pub mod x_user_defined {
#[inline]
pub fn forward(code: u8) -> u16 {
0xf700 | (code as u16)
}
#[inline]
pub fn backward(code: u32) -> u8 {
if (code & !0x7f) == 0xf780 {
(code & 0xff) as u8
} else {
0
}
}
}