Trait lib_ruby_parser::TokenTrait [−][src]
pub trait TokenTrait: Clone + PartialEq + Eq + Debug {}Show methods
fn new(
token_type: i32,
token_value: Bytes,
loc: Loc,
lex_state_before: LexState,
lex_state_after: LexState
) -> Self; fn token_type(&self) -> i32; fn token_value(&self) -> &Bytes; fn set_token_value(&mut self, token_value: Bytes); fn into_token_value(self) -> Bytes; fn loc(&self) -> Loc; fn lex_state_before(&self) -> LexState; fn lex_state_after(&self) -> LexState; fn as_bytes(&self) -> &[u8] { ... } fn into_bytes(self) -> Vec<u8>
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 token_name(&self) -> &'static str { ... }
Expand description
Trait with common methods of Token (Rust- or external-based)
Required methods
Constructor
fn token_type(&self) -> i32
[src]
fn token_type(&self) -> i32
[src]Returns type of the token
fn token_value(&self) -> &Bytes
[src]
fn token_value(&self) -> &Bytes
[src]Returns value of the token
fn set_token_value(&mut self, token_value: Bytes)
[src]
fn set_token_value(&mut self, token_value: Bytes)
[src]Sets token value
fn into_token_value(self) -> Bytes
[src]
fn into_token_value(self) -> Bytes
[src]Consumes self, returns owned values of the token
fn lex_state_before(&self) -> LexState
[src]
fn lex_state_before(&self) -> LexState
[src]Returns lex state before reading the token
fn lex_state_after(&self) -> LexState
[src]
fn lex_state_after(&self) -> LexState
[src]Returns lex state after reading the token
Provided methods
fn into_bytes(self) -> Vec<u8> where
Self: Sized,
[src]
fn into_bytes(self) -> Vec<u8> where
Self: Sized,
[src]Consumes a token and returns an owned byte array of the token value
fn as_str_lossy(&self) -> Result<&str, Utf8Error>
[src]
fn as_str_lossy(&self) -> Result<&str, Utf8Error>
[src]Converts token value into &str
fn to_string_lossy(&self) -> String
[src]
fn to_string_lossy(&self) -> String
[src]Converts token to a string, replaces unknown chars to U+FFFD
fn to_string(&self) -> Result<String, FromUtf8Error>
[src]
fn to_string(&self) -> Result<String, FromUtf8Error>
[src]Converts token to a string
fn into_string(self) -> Result<String, FromUtf8Error> where
Self: Sized,
[src]
fn into_string(self) -> Result<String, FromUtf8Error> where
Self: Sized,
[src]Consumes a token and converts it into a string
fn token_name(&self) -> &'static str
[src]
fn token_name(&self) -> &'static str
[src]Returns name of the token