Rust Runtime for Reactive View-Projections
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Michael Sippel 930759d2a1
add GPLv3 license
3 months ago
src IndexBuffer: add clear() 3 months ago
.gitignore initial commit 4 months ago
COPYING add GPLv3 license 3 months ago
Cargo.toml initial commit 4 months ago add GPLv3 license 3 months ago


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.


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

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

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));