Rust Runtime for Reactive View-Projections
Find a file
2024-06-06 15:11:23 +02:00
.github/workflows add github workflow to run unittests 2024-03-22 19:01:16 +01:00
src vec buffer: add constructor from data-arc 2024-06-06 15:11:23 +02:00
.gitignore initial commit 2023-02-11 23:03:28 +01:00
Cargo.toml initial commit 2023-02-11 23:03:28 +01:00
COPYING add GPLv3 license 2023-03-04 17:54:34 +01:00
README.md add GPLv3 license 2023-03-04 17:54:34 +01:00
rust-toolchain add rust-toolchain 2023-08-14 01:21:52 +02:00

r3vi

Rust Runtime for Reactive View-Projections

Using r3vi you can define Projections, i.e. transformations on Views that are updated reactively on changes in the source-view. These updates are performed incrementally using fine-granuar diffs.

Views are abstract accessor-interfaces that also define the update protocol (the diff). Observers can register to observe a View and are notified with the according diff-message whenever the view changes. Projections are transformations from one view into antoher. They are made of the target view and an observer that observes the source view.

R3vi provides basic data-structures and projections to build projectional pipelines with an interface similar to native rust iterators.

Examples

use r3vi::buffer::vec::*;

let mut buffer = VecBuffer::<i32>::new();
buffer.push(3);

let projected_port = buffer.get_port()
                      .to_sequence()     // make SequenceView from Vec
                      .map(|x| x + 10)
                      .filter(|x| x > 10);

let projected_view = projected_port.get_view();

assert_eq!(projected_view.get(&0), Some(13));

buffer.push(5);   // maps to 15
buffer.push(-9);  // maps to 1, is eliminated by filter
buffer.push(1);   // maps to 11

assert_eq!(projected_view.get(&1), Some(15));
assert_eq!(projected_view.get(&2), Some(11));

License

GPLv3