linksplatform / linksplatform/doublets-rs

Unnecessary trailing Flow::Continue

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Store:Search
Dominant language
Rust
Stars
6
Forks
0
Avg merge
1h 37m
Merged PRs (30d)
1

Description

At the moment, in any `Handler`, you need to return `Try`. This is cool and allows interrupting operations in errors.
But it inflates the code:
```rust
// one operation handler
|link| {
worker.work(link);
Continue // <- :(
}
```
But everyone wants to:
```rust
|link| worker.work(link)
```
I see two ways
---

### **1. Inspired by `std::Termination` create `Termination`-like trait**
It might look something like this:
```rust
trait HandlerResult {
type Try: Try;

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

// impl for ()
// impl for all Try
```
### **2. Discard `Handlers' outside the internal code (track it https://github.com/linksplatform/doublets-rs/issues/3)**
Use `$OP_iter` so `each_iter` and others
example above:
```rust
.each_iter(...).for_each(|link| worker.work(link))
```

#### What do you think about this?
##### In particular @Konard

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the two proposed approaches: a Termination-like HandlerResult trait or removing handlers from the external API through $OP_iter, including the each_iter example. Read linked issue #3 to understand the related direction; done would require a decided approach and a concrete definition of the resulting handler API.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.