Skip to content

diffplug/durian-rx

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

DurianRx: Reactive getters, powered by RxJava and ListenableFuture

Maven central Apache 2.0

Changelog Javadoc Live chat JitCI

DurianRx unifies RxJava's Observable with Guava's ListenableFuture. If you happen to be using SWT as a widget toolkit, then you'll want to look at DurianSwt as well.

Observable<SomeType> observable = someObservable();
ListenableFuture<SomeType> future = someFuture();
Rx.subscribe(observable, val -> doSomething(val));
Rx.subscribe(future, val -> doSomething(val));

It also provides reactive getters, a simple abstraction for piping data which allows access via T get() or Observable<T> asObservable().

RxBox<Point> mousePos = RxBox.of(new Point(0, 0));
this.addMouseListener(e -> mousePos.set(new Point(e.x, e.y)));

Rectangle hotSpot = new Rectangle(0, 0, 10, 10)
RxGetter<Boolean> isMouseOver = mousePos.map(hotSpot::contains);

Debugging an error which involves lots of callbacks can be difficult. To make this easier, DurianRx includes a tracing capability, which makes this task easier.

// anytime an error is thrown in an Rx callback, the stack trace of the error
// will be wrapped by the stack trace of the original subscription
DurianPlugins.register(RxTracingPolicy.class, new LogSubscriptionTrace()).

DurianRx's only requirements are durian-base, durian-collect, durian-concurrent, and RxJava.

Acknowledgements

About

Reactive getters, powered by RxJava and ListenableFuture

Resources

License

Stars

Watchers

Forks

Packages

No packages published