mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-28 04:45:05 +00:00
Document match_ast!
This commit is contained in:
parent
eee55d4663
commit
7ad55e976c
1 changed files with 14 additions and 0 deletions
|
@ -160,6 +160,20 @@ impl SourceFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Matches a `SyntaxNode` against an `ast` type.
|
||||||
|
///
|
||||||
|
/// # Example:
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// match_ast! {
|
||||||
|
/// match node {
|
||||||
|
/// ast::CallExpr(it) => { ... },
|
||||||
|
/// ast::MethodCallExpr(it) => { ... },
|
||||||
|
/// ast::MacroCall(it) => { ... },
|
||||||
|
/// _ => None,
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! match_ast {
|
macro_rules! match_ast {
|
||||||
(match $node:ident {
|
(match $node:ident {
|
||||||
|
|
Loading…
Reference in a new issue