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§
Sourcefn get_to_string(&self, out: &mut String) -> Result<(), FromUtf8Error>
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.
Sourcefn get_as_string(&self) -> Result<String, FromUtf8Error>
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".