hyperium / hyperium/hyper

Provide convenience around serving `ServiceFn`

Open
#2,154 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16.3k
Forks
1.8k
Avg merge
1d 22h
Merged PRs (30d)
14

Description

When making a service to pass to server I've never used make_service_fn in any other way than:

let server = Server::bind(&addr).serve(make_service_fn(|_| async move {
        Ok::<_, Infallible>(service_fn(handler))
}));

It would be nice to be able to write:

let server = Server::bind(&addr).serve(service_fn(handler));

or at least:

let server = Server::bind(&addr).serve(serve_service_fn(service_fn(handler)));

Thoughts?

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 reading the Server::serve, make_service_fn, and service_fn entry points referenced in the issue. Compare the proposed calling forms and clarify the intended API shape with maintainers; done means an agreed convenience is implemented and its behavior is covered by the project's relevant checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.