Skip to content

Unnecessary trailing Flow::Continue #4

@uselessgoddess

Description

@uselessgoddess

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Store:SearchStore: this is about the search

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions