pub struct EncodingMap { /* private fields */ }Expand description
256-entry byte → Unicode (UTF-8 string) map. Most entries hold a
single char but the AGL also defines ligature glyphs whose
expansion is multi-character (/fi → “fi”), so the slot has to
accommodate a short String. Slots for unassigned bytes hold the
empty string — the decoder emits U+FFFD when it sees one.
Implementations§
Source§impl EncodingMap
impl EncodingMap
pub fn new() -> Self
pub fn set_char(&mut self, code: u8, c: char)
pub fn set_string(&mut self, code: u8, s: &str)
Sourcepub fn lookup(&self, code: u8) -> &str
pub fn lookup(&self, code: u8) -> &str
Look up one byte. Returns the empty slice when unassigned (caller substitutes U+FFFD).
Sourcepub fn decode(&self, bytes: &[u8]) -> String
pub fn decode(&self, bytes: &[u8]) -> String
Decode a Tj / TJ byte string into Unicode by walking the
table. Unassigned codes become U+FFFD.
Sourcepub fn from_base(base: BaseEncoding) -> EncodingMap
pub fn from_base(base: BaseEncoding) -> EncodingMap
Build a map from a named BaseEncoding.
Trait Implementations§
Source§impl Clone for EncodingMap
impl Clone for EncodingMap
Source§fn clone(&self) -> EncodingMap
fn clone(&self) -> EncodingMap
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EncodingMap
impl Debug for EncodingMap
Auto Trait Implementations§
impl Freeze for EncodingMap
impl RefUnwindSafe for EncodingMap
impl Send for EncodingMap
impl Sync for EncodingMap
impl Unpin for EncodingMap
impl UnsafeUnpin for EncodingMap
impl UnwindSafe for EncodingMap
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