Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

The example doesn't work with latest version 0.14.12

未关闭
#68 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
45/100
Issue 类型
文档
描述清晰度
描述清楚
活跃度
停滞
技术栈
rust
领域
documentation

调研方向

从项目主页上显示的 Rust 代码示例开始,使用 0.14.12 版本复现未解析的 hyper::Server 导入。更新示例,使其能够在该版本下运行,然后验证显示的代码能够成功编译。

由索引模型根据 Issue 内容生成。

描述

The given code on your home page:

use std::{convert::Infallible, net::SocketAddr};
use hyper::{Body, Request, Response, Server};
use hyper::service::{make_service_fn, service_fn};

async fn handle(_: Request<Body>) -> Result<Response<Body>, Infallible> {
    Ok(Response::new("Hello, World!".into()))
}

#[tokio::main]
async fn main() {
    let addr = SocketAddr::from(([127, 0, 0, 1], 3000));

    let make_svc = make_service_fn(|_conn| async {
        Ok::<_, Infallible>(service_fn(handle))
    });

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

    if let Err(e) = server.await {
        eprintln!("server error: {}", e);
    }
}

The result:

   Compiling http-server v0.1.0 (/Users/chiro/GitHub/rust-playground/http-server)
error[E0432]: unresolved import `hyper::Server`
 --> src/main.rs:2:38
  |
2 | use hyper::{Body, Request, Response, Server};
  |                                      ^^^^^^ no `Server` in the root

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `http-server`

To learn more, run the command again with --verbose.
主要语言
HTML
星标
34
派生
71
平均合并
1 小时 9 分钟
30 天内合并 PR
8

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hyperium/hyperium.github.io 的其他 Issue

查看 hyperium/hyperium.github.io 的全部 Issue

相似的 Issue

更多 Documentation Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。