3 releases (breaking)

0.3.0 May 17, 2024
0.2.0 May 3, 2024
0.1.0 May 3, 2024

#18 in #receive

MIT/Apache

52KB
1.5K SLoC

A library for creating event-based applications

Overview

The library consists of 2 traits:

  • Receive: a generic interface for sending events
  • View: a generic interface for viewing events

Viewer return;

Receiver return, ReceiverResult:

  • Continue: continue processing the output as normal (like Some)
  • Stop: stop processing the output (like None`)
  • Delete: gives back the event with the flag that the receiver should be deleted, this is specifically for communication with routers so that intercepts can be cleanly destructed while letting the event pass through

The different ways to store receivers and viewers are:

  • RcLinker and ArcLinker: a smart pointer that will mark any instances of RcLinked or ArcLinked ready for deletion when dropped, cleaning up any dangling references.
  • Exposed: a container for a receiver that allows multiple Viewers to be prepended
  • Router: a container for a receiver that allows another router to intercept the event at the beginning, by repeating the intercept function it will be delegated to lower routers, allowing a level of abstraction where an intercept does what is expected without breaking the rest of the router.

Aproach

The receivers function as a sort of lazy garbage collector.

When receivers flags that they wish to be deleted (Delete), it should be expected that everything occuring before the introduction of the flag was ran, including viewers and intercepters.

This mean if Delete is received, it is expected that all prior systems have ran and responsibilty falls upon the receiver to continue the event propgation with minimal interuptions.

The exception to this is Stop, which marks that a decision has been made to exit the event propgation.

This means if Stop is received, it is expected that not all prior systems have ran and responsibilty falls upon the receiver to exit the event propgation with minimal impact.

Dependencies

~500KB
~11K SLoC