cascade
: Cascade expressions in Rust!
cascade
is a macro library for Rust that makes it easy and ergonomic
to use cascade-like expressions, similar to Dart.
extern crate cascade;
This is only a small example of what cascade
lets you do:
the basic_cascades
example in this repository covers the other
cool features of the cascade!
macro.
Why does this need to exist?
Cascades reduce boilerplate by eliminating the need for a 'temporary' variable when making several method calls in a row, and it also helps make struct member assignments look more ergonomic. For example:
extern crate cascade;
In addition, cascades make it easier to design fluent interfaces.
No more returning self
with every single function!
Credits
Written by Jackson Lewis