如何在Rust中定义双向树结构?

时间:2018-11-21 18:21:15

标签: data-structures struct tree rust

我的意思是一棵树,其中每个节点都有多个子代,每个子代都引用其父代。

我已经走了这么远:

pub struct Post {
    content: String,
    links: Vec<Post>,
    parent: Box<Post>,
}

impl Post {
    pub fn new() -> Post {
        Post {
            content: String::new(),
            links: Vec::new(),
            parent: Box::new(......),
        }
    }
}

我要用点代替什么?

0 个答案:

没有答案