Crates.io | szyk |
lib.rs | szyk |
version | 1.0.2 |
source | src |
created_at | 2021-04-04 14:41:58.007182 |
updated_at | 2021-04-16 16:07:56.431617 |
description | generic topological sort |
homepage | |
repository | https://github.com/mnkisala/szyk-rs |
max_upload_size | |
id | 378817 |
size | 7,592 |
Generic topsort for Rust
use szyk::Node;
use szyk;
let result = szyk::sort(
&[
Node::new("wooden pickaxe", vec!["planks", "sticks"], "Pickaxe"),
Node::new("planks", vec!["wood"], "Planks"),
Node::new("sticks", vec!["planks"], "Sticks"),
Node::new("wood", vec![], "Wood"),
],
"wooden pickaxe",
);
assert_eq!(result, Ok(vec!["Wood", "Planks", "Sticks", "Pickaxe"]));