pub struct Encoding<'a> {
pub kind: EncodingKind<'a>,
/* private fields */
}
Fields§
§kind: EncodingKind<'a>
Implementations§
Source§impl Encoding<'_>
impl Encoding<'_>
pub fn new_standard() -> Self
pub fn new_expert() -> Self
pub fn code_to_gid(&self, charset: &Charset<'_>, code: u8) -> Option<GlyphId>
Sourcepub fn get_table(&self) -> Vec<u8> ⓘ
pub fn get_table(&self) -> Vec<u8> ⓘ
Examples found in repository?
examples/tounicode.rs (line 15)
5fn main() {
6 // open the file passed on the comanmand line
7 let path = std::env::args().nth(1).expect("no file given");
8 let file = std::fs::File::open(&path).expect("could not open file");
9 let mut reader = std::io::BufReader::new(file);
10 let mut buffer = Vec::new();
11 reader.read_to_end(&mut buffer).expect("could not read file");
12 let table = Table::parse(&buffer).unwrap();
13
14 let charset = table.charset.get_table();
15 let encoding = table.encoding.get_table();
16 for i in 0..encoding.len() {
17 let cid = encoding[i];
18 let sid = charset[i];
19 println!("{}: {:?}", cid, string_by_id(&table, sid));
20 }
21
22}
Trait Implementations§
impl<'a> Copy for Encoding<'a>
Auto Trait Implementations§
impl<'a> Freeze for Encoding<'a>
impl<'a> RefUnwindSafe for Encoding<'a>
impl<'a> Send for Encoding<'a>
impl<'a> Sync for Encoding<'a>
impl<'a> Unpin for Encoding<'a>
impl<'a> UnwindSafe for Encoding<'a>
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