Trait proc_macro_utils::TokenTreeLiteral

source ·
pub trait TokenTreeLiteral: Sealed {
    // Required methods
    fn is_string(&self) -> bool;
    fn string(&self) -> Option<String>;
}
Expand description

Trait to parse literals

Required Methods§

source

fn is_string(&self) -> bool

Tests if the token is a string literal.

source

fn string(&self) -> Option<String>

Returns the string contents if it is a string literal.

Implementations on Foreign Types§

source§

impl TokenTreeLiteral for TokenTree

Available on crate feature proc-macro only.
source§

fn is_string(&self) -> bool

Tests if the token is a string literal.

source§

fn string(&self) -> Option<String>

Returns the string contents if it is a string literal.

source§

impl TokenTreeLiteral for TokenTree

Available on crate feature proc-macro2 only.
source§

fn is_string(&self) -> bool

Tests if the token is a string literal.

source§

fn string(&self) -> Option<String>

Returns the string contents if it is a string literal.

source§

impl TokenTreeLiteral for Literal

Available on crate feature proc-macro only.
source§

impl TokenTreeLiteral for Literal

Available on crate feature proc-macro2 only.

Implementors§