]> git.lizzy.rs Git - rust.git/commitdiff
Document match_ast!
authorkjeremy <kjeremy@gmail.com>
Wed, 30 Oct 2019 18:38:45 +0000 (14:38 -0400)
committerkjeremy <kjeremy@gmail.com>
Wed, 30 Oct 2019 18:38:45 +0000 (14:38 -0400)
crates/ra_syntax/src/lib.rs

index c315ba552814aaa7e03f554fb143991fe84ed26e..5dcb6a95a6637d378ef7afaee6365263acb8efd5 100644 (file)
@@ -160,6 +160,20 @@ pub fn parse(text: &str) -> Parse<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_rules! match_ast {
     (match $node:ident {