pub enum Token {
Show 37 variants
Eq,
Lt,
Le,
EqEq,
Ne,
Ge,
Gt,
AndAnd,
OrOr,
Not,
Tilde,
BinOp(BinOpToken),
BinOpEq(BinOpToken),
At,
Dot,
DotDot,
DotDotDot,
DotDotEq,
Comma,
Semi,
Colon,
ModSep,
LArrow,
RArrow,
FatArrow,
Pound,
Dollar,
Question,
SingleQuote,
OpenDelim(Delimiter),
CloseDelim(Delimiter),
Lit(Lit),
Ident(String),
Lifetime(String),
Keyword(KeywordToken),
DocComment(String),
Eof,
}Variants§
Eq
Lt
Le
EqEq
Ne
Ge
Gt
AndAnd
OrOr
Not
Tilde
BinOp(BinOpToken)
BinOpEq(BinOpToken)
At
Dot
DotDot
DotDotDot
DotDotEq
Comma
Semi
Colon
ModSep
LArrow
RArrow
FatArrow
Pound
Dollar
Question
SingleQuote
OpenDelim(Delimiter)
CloseDelim(Delimiter)
Lit(Lit)
Ident(String)
Lifetime(String)
Keyword(KeywordToken)
DocComment(String)
Eof
Implementations§
source§impl Token
impl Token
sourcepub fn lit(lit: impl Into<Lit>) -> Self
pub fn lit(lit: impl Into<Lit>) -> Self
Examples found in repository?
examples/hello.rs (line 7)
1 2 3 4 5 6 7 8 9 10 11 12 13
fn main() -> Result<(), Box<dyn std::error::Error>> {
use ruast::*;
let mut krate = Crate::new();
let def = Fn::main(
None,
Block::from(Path::single("println").mac_call(vec![Token::lit("Hello, world!")])),
);
krate.add_item(def);
println!("{krate}");
// krate.dump("hello.rs")?;
Ok(())
}pub fn ident(ident: impl Into<String>) -> Self
Trait Implementations§
source§impl From<Token> for TokenStream
impl From<Token> for TokenStream
source§impl From<UnaryOpKind> for Token
impl From<UnaryOpKind> for Token
source§fn from(value: UnaryOpKind) -> Self
fn from(value: UnaryOpKind) -> Self
Converts to this type from the input type.
source§impl PartialEq for Token
impl PartialEq for Token
impl Eq for Token
impl StructuralEq for Token
impl StructuralPartialEq for Token
Auto Trait Implementations§
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnwindSafe for Token
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more