summaryrefslogtreecommitdiffstats
path: root/vendor/datafrog/README.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/datafrog/README.md
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/datafrog/README.md')
-rw-r--r--vendor/datafrog/README.md44
1 files changed, 44 insertions, 0 deletions
diff --git a/vendor/datafrog/README.md b/vendor/datafrog/README.md
new file mode 100644
index 000000000..948358410
--- /dev/null
+++ b/vendor/datafrog/README.md
@@ -0,0 +1,44 @@
+# datafrog
+
+Datafrog is a lightweight Datalog engine intended to be embedded in other Rust programs.
+
+Datafrog has no runtime, and relies on you to build and repeatedly apply the update rules.
+It tries to help you do this correctly. As an example, here is how you might write a reachability
+query using Datafrog (minus the part where we populate the `nodes` and `edges` initial relations).
+
+```rust
+extern crate datafrog;
+use datafrog::Iteration;
+
+fn main() {
+
+ // Create a new iteration context, ...
+ let mut iteration = Iteration::new();
+
+ // .. some variables, ..
+ let nodes_var = iteration.variable::<(u32,u32)>("nodes");
+ let edges_var = iteration.variable::<(u32,u32)>("edges");
+
+ // .. load them with some initial values, ..
+ nodes_var.insert(nodes.into());
+ edges_var.insert(edges.into());
+
+ // .. and then start iterating rules!
+ while iteration.changed() {
+ // nodes(a,c) <- nodes(a,b), edges(b,c)
+ nodes_var.from_join(&nodes_var, &edges_var, |_b, &a, &c| (c,a));
+ }
+
+ // extract the final results.
+ let reachable: Vec<(u32,u32)> = variable.complete();
+}
+```
+
+If you'd like to read more about how it works, check out [this blog post](https://github.com/frankmcsherry/blog/blob/master/posts/2018-05-19.md).
+
+## Authorship
+
+Datafrog was initially developed by [Frank McSherry][fmc] and was
+later transferred to the rust-lang-nursery organization. Thanks Frank!
+
+[fmc]: https://github.com/frankmcsherry