r3vi is a Rust library designed to handle reactive transformations on data views, known as Projections. These projections are updated incrementally and efficiently whenever the source data changes, utilizing fine-grained diffs.
- **Views**: Abstract accessor interfaces that define the protocol for updates, including the structure of the diffs.
- **Observers**: Entities that can register to monitor a View and receive notifications with the appropriate diff messages whenever the view undergoes changes.
- **Projections**: Transformations from one view to another. A projection comprises a target view and an observer that listens to changes in the source view and updates the target view accordingly.
r3vi provides essential data structures and projections to build projectional pipelines with an interface similar to native Rust iterators, enabling seamless and reactive data transformations.
1.**Creating a Buffer**: We start by creating a `VecBuffer` to store integers.
2.**Defining a Projection**: Using `get_port()`, we convert the buffer to a sequence view, apply a map transformation to add 10 to each element, and then filter out values less than or equal to 10.
3.**Obtaining a View**: The transformed data is accessed through `get_view()`, allowing us to interact with the projected data.
4.**Reactive Updates**: As new elements are added to the buffer, the projections update reactively, maintaining the transformations and filters defined.
This example demonstrates the reactive nature of r3vi's projections, where changes in the source data are automatically and incrementally propagated to the target view.