Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary trailing Flow::Continue #4

Open
uselessgoddess opened this issue Jul 30, 2022 · 0 comments
Open

Unnecessary trailing Flow::Continue #4

uselessgoddess opened this issue Jul 30, 2022 · 0 comments
Labels
Store:Search Store: this is about the search

Comments

@uselessgoddess
Copy link
Member

uselessgoddess commented Jul 30, 2022

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:

// one operation handler
|link| {
    worker.work(link);
    Continue // <- :(
}

But everyone wants to:

|link| worker.work(link)

I see two ways

1. Inspired by std::Termination create Termination-like trait

It might look something like this:

trait HandlerResult {
    type Try: Try<Output = ()>;

    fn try_it(self) -> Self::Try;
}

// impl for ()
// impl for all Try

2. Discard `Handlers' outside the internal code (track it #3)

Use $OP_iter so each_iter and others
example above:

.each_iter(...).for_each(|link| worker.work(link))

What do you think about this?

In particular @Konard
@uselessgoddess uselessgoddess added the Store:Search Store: this is about the search label Jul 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Store:Search Store: this is about the search
Projects
None yet
Development

No branches or pull requests

1 participant