Trait lib_ruby_parser::BytesTrait [−][src]
pub trait BytesTrait: Index<usize> + Default + Debug + Clone + PartialEq + Eq {}Show methods
fn new(raw: Vec<u8>) -> Self; fn as_raw(&self) -> &[u8]; fn into_raw(self) -> Vec<u8>
where
Self: Sized; fn set_raw(&mut self, raw: Vec<u8>); fn push(&mut self, byte: u8); fn empty() -> Self
where
Self: Sized, { ... } fn as_str_lossy(&self) -> Result<&str, Utf8Error> { ... } fn to_string_lossy(&self) -> String { ... } fn to_string(&self) -> Result<String, FromUtf8Error> { ... } fn into_string(self) -> Result<String, FromUtf8Error>
where
Self: Sized, { ... } fn is_valid_utf8(&self) -> bool { ... } fn is_empty(&self) -> bool { ... } fn len(&self) -> usize { ... } fn clear(&mut self) { ... }
Expand description
Trait with common methods of Bytes (Rust- or external-based)
Required methods
Provided methods
fn as_str_lossy(&self) -> Result<&str, Utf8Error>
[src]
fn as_str_lossy(&self) -> Result<&str, Utf8Error>
[src]Converts byte sequence to a string slice, returns error if there are invalid UTF-8 chars
fn to_string_lossy(&self) -> String
[src]
fn to_string_lossy(&self) -> String
[src]Converts byte sequnce to a string, all invalid UTF-8 chars are converted into “replacement char”
fn to_string(&self) -> Result<String, FromUtf8Error>
[src]
fn to_string(&self) -> Result<String, FromUtf8Error>
[src]Converts byte sequence to a String, returns error if there are invalid UTF-8 chars
fn into_string(self) -> Result<String, FromUtf8Error> where
Self: Sized,
[src]
fn into_string(self) -> Result<String, FromUtf8Error> where
Self: Sized,
[src]Consumes itself and convrters it into a string, returns error if there are invalid UTF-8 chars
fn is_valid_utf8(&self) -> bool
[src]
fn is_valid_utf8(&self) -> bool
[src]Returns true
if self
represents a valid UTF-8 string