tendril::fmt

Trait CharFormat

Source
pub unsafe trait CharFormat<'a>: Format {
    type Iter: Iterator<Item = (usize, char)>;

    // Required methods
    unsafe fn char_indices(buf: &'a [u8]) -> Self::Iter;
    fn encode_char<F>(ch: char, cont: F) -> Result<(), ()>
       where F: FnOnce(&[u8]);
}
Expand description

Indicates a format which contains characters from Unicode (all of it, or some proper subset).

Required Associated Types§

Source

type Iter: Iterator<Item = (usize, char)>

Iterator for characters and their byte indices.

Required Methods§

Source

unsafe fn char_indices(buf: &'a [u8]) -> Self::Iter

Iterate over the characters of the string and their byte indices.

You may assume the buffer is already validated for Format.

Source

fn encode_char<F>(ch: char, cont: F) -> Result<(), ()>
where F: FnOnce(&[u8]),

Encode the character as bytes and pass them to a continuation.

Returns Err(()) iff the character cannot be represented.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§