Struct doomdooz_lib::types::Bytes
source · Expand description
Representation of a byte sequence
Fields§
§raw: Vec<u8, Global>Raw vector of bytes
Implementations§
source§impl Bytes
impl Bytes
sourcepub fn as_str_lossy(&self) -> Result<&str, Utf8Error>
pub fn as_str_lossy(&self) -> Result<&str, Utf8Error>
Converts byte sequence to a string slice, returns error if there are invalid UTF-8 chars
sourcepub fn to_string_lossy(&self) -> String
pub fn to_string_lossy(&self) -> String
Converts byte sequnce to a string, all invalid UTF-8 chars are converted into “replacement char”
sourcepub fn to_string(&self) -> Result<String, FromUtf8Error>
pub fn to_string(&self) -> Result<String, FromUtf8Error>
Converts byte sequence to a String, returns error if there are invalid UTF-8 chars
sourcepub fn into_string(self) -> Result<String, FromUtf8Error>
pub fn into_string(self) -> Result<String, FromUtf8Error>
Consumes itself and convrters it into a string, returns error if there are invalid UTF-8 chars
sourcepub fn is_valid_utf8(&self) -> bool
pub fn is_valid_utf8(&self) -> bool
Returns true if self represents a valid UTF-8 string