Open uselessgoddess opened 2 years ago
At the moment, in any Handler, you need to return Try<Output = ()>. This is cool and allows interrupting operations in errors. But it inflates the code:
Handler
Try<Output = ()>
// one operation handler |link| { worker.work(link); Continue // <- :( }
But everyone wants to:
|link| worker.work(link)
I see two ways
std::Termination
Termination
It might look something like this:
trait HandlerResult { type Try: Try<Output = ()>; fn try_it(self) -> Self::Try; } // impl for () // impl for all Try
Use $OP_iter so each_iter and others example above:
$OP_iter
each_iter
.each_iter(...).for_each(|link| worker.work(link))
At the moment, in any
Handler
, you need to returnTry<Output = ()>
. This is cool and allows interrupting operations in errors. But it inflates the code:But everyone wants to:
I see two ways
1. Inspired by
std::Termination
createTermination
-like traitIt might look something like this:
2. Discard `Handlers' outside the internal code (track it https://github.com/linksplatform/doublets-rs/issues/3)
Use
$OP_iter
soeach_iter
and others example above:What do you think about this?
In particular @Konard