Skip to main content

StringRead

Trait StringRead 

Source
pub trait StringRead {
    // Required methods
    fn get_to_string(&self, out: &mut String) -> Result<(), FromUtf8Error>;
    fn get_as_string(&self) -> Result<String, FromUtf8Error>;
}
Expand description

Trait for data accessors that can be read as strings

Required Methods§

Source

fn get_to_string(&self, out: &mut String) -> Result<(), FromUtf8Error>

Reads the value of this dataref and appends it to the provided string

If the provided string is not empty, the value of the dataref will be appended to it.

§Errors

Returns an error if the dataref is not valid UTF-8.

Source

fn get_as_string(&self) -> Result<String, FromUtf8Error>

Reads the value of this dataref as a string and returns it.

§Errors

Returns an error if the dataref is not valid UTF-8.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> StringRead for T
where T: ArrayRead<[u8]>,