[]Trait html5ever::tendril::fmt::CharFormat

pub unsafe trait CharFormat<'a>: Format where
    <Self::Iter as Iterator>::Item == (usize, char)
{ type Iter: Iterator; unsafe fn char_indices(buf: &'a [u8]) -> Self::Iter;
fn encode_char<F>(ch: char, cont: F) -> Result<(), ()>
    where
        F: FnOnce(&[u8])
; }

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

Associated Types

type Iter: Iterator

Iterator for characters and their byte indices.

Loading content...

Required methods

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.

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.

Loading content...

Implementors

impl<'a> CharFormat<'a> for ASCII

type Iter = SingleByteCharIndices<'a>

impl<'a> CharFormat<'a> for Latin1

type Iter = SingleByteCharIndices<'a>

impl<'a> CharFormat<'a> for UTF8

type Iter = CharIndices<'a>

Loading content...