Struct bag::Node [] [src]

pub struct Node<T> {
    pub data: T,
    // some fields omitted
}

A generic container for a node

A Node<T> contains the following: - An optional identifier for a parent Node<T> - A Vec of identifiers for children Node<T>s - A publicly visible member of type T to hold program specific data

Fields

Methods

impl<T> Node<T>
[src]

[src]

Constructs a new Node<T>

Accepts the node's data of type T. By default, Node<T>s have no parent, this is set on insertion into the graph.

Example

use bag::Node;
#[derive(Debug,Eq,PartialEq)]
struct InternalData {
    name: String,
    id: i32
}
let node = Node::new(InternalData{name: "NodeTest".to_string(), id: 42});
assert_eq!(*node.parent(), None);
assert_eq!(*node.children(), Vec::new());
assert_eq!(node.data, InternalData{name: "NodeTest".to_string(), id:42});

[src]

[src]

Trait Implementations

impl<T: Debug> Debug for Node<T>
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<T> Send for Node<T> where
    T: Send

impl<T> Sync for Node<T> where
    T: Sync