rust fragment specifier

Specifier Description Examples
ident Identifier x, foo
path Qualified name std::collection::HashSet, Vec::new
ty Type i32, &T, Vec<(char, String)>
expr Expression 2+2, f(42), if true { 1 } else
pat Pattern _, c @ 'a' ... 'z', (true, &x), Badger
stmt Statement let x = 3, return 42
block Brace-delimited block { foo(); bar(); },
item Item fn foo() {}, struct Bar;, use std::io;
meta Inside of attribute cfg!(windows), doc="comment"
tt Token tree +, foo, 5, [?!(???)]

原文:https://riptutorial.com/rust/example/5646/fragment-specifiers---kind-of-patterns

posted @ 2024-09-28 14:09  寻找繁星  阅读(8)  评论(0)    收藏  举报