Struct lib_ruby_parser::Bytes
source · [−]Expand description
Representation of a byte sequence
Fields
raw: Vec<u8>
Raw vector of bytes
Implementations
sourceimpl 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
Trait Implementations
impl Eq for Bytes
impl StructuralEq for Bytes
impl StructuralPartialEq for Bytes
Auto Trait Implementations
impl RefUnwindSafe for Bytes
impl Send for Bytes
impl Sync for Bytes
impl Unpin for Bytes
impl UnwindSafe for Bytes
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more