Struct lib_ruby_parser::Bytes
source · #[repr(C)]pub struct Bytes {
pub raw: Vec<u8>,
}
Expand description
Representation of a byte sequence
Fields§
§raw: Vec<u8>
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 sequence 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§
source§impl PartialEq for Bytes
impl PartialEq for Bytes
impl Eq for Bytes
impl StructuralPartialEq for Bytes
Auto Trait Implementations§
impl Freeze for Bytes
impl RefUnwindSafe for Bytes
impl Send for Bytes
impl Sync for Bytes
impl Unpin for Bytes
impl UnwindSafe for Bytes
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more