sot

Crates.iosot
lib.rssot
version0.0.2
sourcesrc
created_at2022-10-04 03:37:06.853766
updated_at2022-10-05 16:38:36.682491
descriptionSimple Object Tree
homepagehttps://github.com/objectionary/sot
repositoryhttps://github.com/objectionary/sot
max_upload_size
id679588
size42,156
Yegor Bugayenko (yegor256)

documentation

README

logo

EO principles respected here We recommend IntelliJ IDEA

cargo crates.io PDD status codecov Hits-of-Code Lines of code License

This Rust library helps you build an object tree for reo compiler of EO programs.

Create a tree:

use sot::Sot;
let mut sot = Sot::empty();
sot.add(0)?; // add a vertex no.0
sot.add(1)?; // add a vertex no.1
sot.bind(0, 1, "foo")?; // connect v0 to v1 with label "foo"
sot.put(1, "Hello, world!".as_bytes().to_vec())?; // attach data to v1

You can find a vertex by the label of an edge departing from another vertex:

let id = sot.kid(0, "foo")?; // returns 1

You can find all kids of a vertex:

let kids: Vec<(String, u32)> = sot.kids(0);

You can read the data of a vertex:

let bytes: Vec<u8> = sot.data(1)?; // empty if no data written before

Then, you can print the tree:

println!("{:?}", sot);

Also, you can serialize and deserialize the tree.

Commit count: 431

cargo fmt