Trait write16::Write16

source ·
pub trait Write16 {
    // Required method
    fn write_slice(&mut self, s: &[u16]) -> Result;

    // Provided methods
    fn write_char(&mut self, c: char) -> Result { ... }
    fn size_hint(&mut self, upcoming: usize) -> Result { ... }
}
Expand description

A UTF-16 sink analogous to core::fmt::Write.

Required Methods§

source

fn write_slice(&mut self, s: &[u16]) -> Result

Write a slice containing UTF-16 to the sink.

The implementor of the trait should not validate UTF-16. It’s the responsibility of the caller to pass valid UTF-16.

Provided Methods§

source

fn write_char(&mut self, c: char) -> Result

Write a Unicode scalar value to the sink.

source

fn size_hint(&mut self, upcoming: usize) -> Result

A hint that the caller expects to write upcoming UTF-16 code units. The implementation must not assume upcoming to be exact. The caller may write more or fewer code units using write_slice() and write_char(). However, the caller should try to give reasonable estimates if it uses this method.

For Vec and SmallVec, this maps to reserve(). The default implementation does nothing.

Implementations on Foreign Types§

source§

impl Write16 for Vec<u16>

source§

fn write_slice(&mut self, s: &[u16]) -> Result

source§

fn write_char(&mut self, c: char) -> Result

source§

fn size_hint(&mut self, upcoming: usize) -> Result

Implementors§