Skip to content

Commit

Permalink
#75 doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 12, 2023
1 parent 2242ad6 commit c3ee604
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 133 deletions.
130 changes: 1 addition & 129 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "sodg"
version = "0.0.0"
edition = "2021"
repository = "https://github.com/objectionary/sodg"
description = "Simple Object DiGraph"
description = "Surging Object DiGraph (SODG)"
readme = "README.md"
license-file = "LICENSE.txt"
homepage = "https://github.com/objectionary/sodg"
Expand All @@ -30,4 +30,3 @@ rstest = "0.16.0"
fsutils = "0.1.7"
tempfile = "3.3.0"
predicates = "2.1.5"
clippy = "0.0.302"
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ Create a graph:

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

You can find a vertex by the label of an edge departing from another vertex:
Expand All @@ -42,7 +43,7 @@ let kids: Vec<(String, u32)> = g.kids(0);
You can read the data of a vertex:

```rust
let bytes: Vec<u8> = g.data(1)?; // empty if no data written before
let bytes: Hex = g.data(1)?.to_i64()?;
```

Then, you can print the graph:
Expand Down

0 comments on commit c3ee604

Please sign in to comment.