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

Constructs Bytes based on a given vector

Returns a reference to inner data

“Unwraps” self and returns inner data

Replaces inner data with given list

Appends a byte

Provided methods

Constructs an empty instance of Bytes

Converts byte sequence to a string slice, returns error if there are invalid UTF-8 chars

Converts byte sequnce to a string, all invalid UTF-8 chars are converted into “replacement char”

Converts byte sequence to a String, returns error if there are invalid UTF-8 chars

Consumes itself and convrters it into a string, returns error if there are invalid UTF-8 chars

Returns true if self represents a valid UTF-8 string

Returns true if byte sequence is empty

Returns length of the byte sequence

Clears inner data

Implementors