1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use codec;
use 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<RawEncoder> { codec::utf_8::UTF8Encoding.raw_encoder() }
fn raw_decoder(&self) -> Box<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}
}
}