Skip to content

diffplug/durian-rx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
runner
Feb 1, 2025
adcc4d3 · Feb 1, 2025
Jan 25, 2025
Jan 22, 2025
Feb 1, 2025
Jul 23, 2018
Oct 21, 2021
Feb 1, 2025
Jan 13, 2020
Apr 20, 2015
Feb 1, 2025
Jan 26, 2025
May 18, 2015
Apr 20, 2015
Apr 20, 2015
Jan 22, 2025
Jan 22, 2025
Jan 22, 2025
Jan 26, 2025

Repository files navigation

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