3 releases (breaking)
0.3.0 | May 17, 2024 |
---|---|
0.2.0 | May 3, 2024 |
0.1.0 | May 3, 2024 |
#18 in #receive
52KB
1.5K
SLoC
A library for creating event-based applications
Overview
The library consists of 2 traits:
Viewer return;
DeleteView
: flag to delete the viewer
Receiver return, ReceiverResult
:
Continue
: continue processing the output as normal (likeSome
)Stop
: stop processing the output (likeNone
`)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
andArcLinker
: a smart pointer that will mark any instances ofRcLinked
orArcLinked
ready for deletion when dropped, cleaning up any dangling references.Exposed
: a container for a receiver that allows multipleView
ers to be prependedRouter
: 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