Trait StrEncoder

Source
pub trait StrEncoder: BaseEncoder {
    // Required method
    fn put_str(&mut self, string: &str) -> Result<(), Self::Error>;
}
Expand description

A trait for encoders that can handle UTF-8 encodables.

This trait extends BaseEncoder to include a types and methods specifically used for handling UTF-8 encodables. Encoders may use this trait as bounds for generic encodables to signal that the output will be UTF-8 encoded. Doing so allows encoders such as String to be used.

Required Methods§

Source

fn put_str(&mut self, string: &str) -> Result<(), Self::Error>

Writes an str into the encoder.

§Errors

Returns an error if the encoder is unable to write the string due to capacity limits, encoding errors, or internal failures.

Implementations on Foreign Types§

Source§

impl StrEncoder for String

Source§

fn put_str(&mut self, string: &str) -> Result<(), Self::Error>

Source§

impl StrEncoder for Formatter<'_>

Source§

fn put_str(&mut self, string: &str) -> Result<(), Self::Error>

Source§

impl<const SIZE: usize> StrEncoder for ArrayString<SIZE>

Source§

fn put_str(&mut self, string: &str) -> Result<(), Self::Error>

Implementors§

Source§

impl<T> StrEncoder for T
where T: ByteEncoder,