Module polygraph::example[][src]

Expand description

Example

use polygraph::example::{Schema, Foo, Test};
let mut db = Schema::new();
let fortytwo = db.insert_foo(Foo(42));
assert_eq!(fortytwo.d(&db).0, 42); println!("about to add 50");
let fifty = db.insert_foo(Foo(50));
// We can't keep using the fifty and fortytwo above, because they mutably
// borrowed our `db`.  But we can now look them both up and use them both.
let fifty = db.lookup_foo(&Foo(50)).unwrap();
let fortytwo = db.lookup_foo(&Foo(42)).unwrap();
assert_eq!(fifty.d(&db).0 - fortytwo.d(&db).0, 8);
let db = polygraph::example::tree::Tree::new();

Modules

tree

Structs

Foo

This is another cool test named Foo

FooQuery

This is plain old data. This is another cool test named Foo

Key
Schema
Test

This is a cool test!

TestQuery

This is plain old data. This is a cool test!

Enums

NotHere

This is not in the schema.