nb-tree 0.2.0-alpha01

Very simple tree structure with generic node and branch data.
Documentation
/// Force AST node to an expression to improve diagnostics in pattern position.
#[doc(hidden)]
#[macro_export]
macro_rules! __rust_force_expr {
    ($e:expr) => {
        $e
    };
}

//TODO: not rely on vec?
/// Build a [`Path`] from a list of expressions.
/// ```
/// use nb_tree::{path, path::Path};
/// let path: Path<String> = path!["a", "b", "c", "d", "e", "f"];
/// assert_eq!(path, "/a/b/c/d/e/f".into());
/// ```
///
/// [`Path`]: crate::path::Path
#[macro_export]
macro_rules! path {
    () => (
        $crate::__rust_force_expr!($crate::path::Path::new())
    );
    ($elem:expr; $n:expr) => (
        $crate::__rust_force_expr!($crate::path::Path::from(std::vec::from_elem($elem, $n)))
    );
    ($($x:expr),+ $(,)?) => (
        $crate::__rust_force_expr!($crate::path::Path::from(<[_]>::into_vec(
            std::boxed::Box::new([$($x),+])
        )))
    );
}

//TODO: tree macro
//inspiration: https://docs.rs/serde_json/latest/src/serde_json/macros.rs.html#54-59

#[cfg(test)]
mod tests {
    use crate::{path, prelude::Path /*, tree, tree::Tree*/};

    #[test]
    fn path() {
        let path: Path<(i32, bool)> = path![(7, false), (2, true), (8, true)];
        assert_eq!(path, vec![(7, false), (2, true), (8, true)].into());
    }

    /*
    #[test]
    fn tree() {
        let small_tree: Tree<i32, i32> = tree! {5};
        let st: Tree<i32, i32> = Tree::new();
        st.i("/", 5);
        assert_eq!(small_tree, st);

        let tree: Tree<String, usize> = tree! {
            "Hello!",
            [
                0 => {"This"},
                1 => {"Is"},
                2 => {"A"},
                3 => {"Tree!",
                    [
                        9 => {"hi"},
                        2 => {"there"},
                    ]
                }
            ]
        };
        let t: Tree<String, usize> = Tree::new();
        t.i("/", "Hello!".into())
            .i("/0", "This".into())
            .i("/1", "Is".into())
            .i("/2", "A".into())
            .i("/3", "Tree".into())
            .i("/3/9", "hi".into())
            .i("/3/2", "there".into());
        assert_eq!(small_tree, t);
    }*/
}