Skip to main content

dispatch

Macro dispatch 

Source
macro_rules! dispatch {
    ($node:expr, [$($ty:ty => $method:ident($($param:expr),*)),*]) => { ... };
}
Expand description

Calls a method on any node that matches any of the provided types. Unlike dispatch_once, it will not return.

§Example

use ast::generated::{FunctionDefinition, ClassDefinition};
use lsp_max_ast::dispatch;

/* ... */
dispatch!(node.lower(), [
    FunctionDefinition => get_something(db, param),
    ClassDefinition => get_something(db, param)
]);