1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//! Example nodes implementing trait `Node`
use crate::traits::*;

/// Use this, if you do not need to store extra information
#[derive(Clone, Debug)]
pub struct EmptyNode {}

impl Node for EmptyNode {
    fn new_from_index(_: u32) -> Self {
        EmptyNode { }
    }

    fn make_string(&self) -> Option<String> {
        Some("".to_string())
    }


    fn parse_str(_to_parse: &str) -> Option<(&str, Self)>
        where Self: Sized
    {
        Some((_to_parse, EmptyNode{ }))
    }
}