Skip to main content

as_type_data

Macro as_type_data 

Source
macro_rules! as_type_data {
    ($arena:expr, $node_ref:expr, $variant:ident) => { ... };
    ($node:expr, $variant:ident) => { ... };
}
Expand description

Helper macro to work with type data.

ยงExamples

use rushdown::ast::{Arena, NodeRef, TypeData, Block, Paragraph};
use rushdown::as_type_data;

let mut arena = Arena::new();
let para_ref: NodeRef = arena.new_node(Paragraph::new());
let data = as_type_data!(arena, para_ref, Block);
assert!(data.source().is_empty());
let data = as_type_data!(arena[para_ref], Block);
assert!(data.source().is_empty());