| Crates.io | pretty_graph |
| lib.rs | pretty_graph |
| version | 0.6.0 |
| created_at | 2026-01-15 08:27:27.457083+00 |
| updated_at | 2026-01-22 05:33:03.837528+00 |
| description | pretty_graph provides simple toolbox to build and working with graphs |
| homepage | https://github.com/glabSdr/pretty_graph |
| repository | https://github.com/glabSdr/pretty_graph |
| max_upload_size | |
| id | 2044899 |
| size | 30,885 |
pretty_graph provides simple toolbox to build and working with graphs.
Struct Node is main operation element - technically link to StrNodeBody (private struct).
StrNodeBody can contains key -> value fields. StrNodeBody supports only fields type &'static str.
StrNodeBody can contains key -> Node fields.
use pretty_graph::Node;
fn main() {
let node_1 = Node::from(None, None);
node_1.set("key1", "value1");
node_1.set("key2", "value2");
let node_2 = Node::new();
node_2.link("node_1", node_1);
let node_3 = Node::new();
node_3.link("node_2", node_2);
match node_3.node_by_chain(vec!["node_2", "node_1"]) {
Some(node_1) => {
for k in node_1.keys().iter() {
println!("{:?}", node_1.get(k).unwrap());
}
},
None => println!("No node found by path: [\"node_2\", \"node_1\"]")
}
}
fn main() {
let node = Node::new();
node.set("key", "value");
std::thread::spawn(move || {
println!("{:?}", node.get("key"))
});
sleep(Duration::from_millis(100));
}