The return type `http_body_util::Collected::aggregate` is unnamable

Open
#134 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust

Research direction

Start at http_body_util::Collected::aggregate and inspect the current impl Buf return type and the surrounding Collected definitions. The work is done when the aggregate result has a public, namable type such as BufList that can be used as Bufferer::Data while preserving the bytes::Buf behavior.

Written by the indexing model from the issue text.

Description

pub fn aggregate(self) -> impl Buf {
    self.bufs
}

Can we turn impl Buf into a namable type (BufList<B>)? It is nice to use impl Buf and all, but today it makes it impossible to use it as a trait associated type.

Example:

trait Bufferer {
    type Data: bytes::Buf;

    // ...
}

impl<B> Bufferer for Collected<B> {
    type Data = ?; // can't just `impl Buf` now
}
Dominant language
Rust
Stars
173
Forks
71
Avg merge
1d 12h
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from hyperium/http-body

All issues in hyperium/http-body

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.