Trait 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§