The example doesn't work with latest version 0.14.12
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 45/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- rust
调研方向
从项目主页上显示的 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
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
hyperium/hyperium.github.io 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
hyperium/hyperium.github.io#58 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 35/100
hyperium/hyperium.github.io#57 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
hyperium/hyperium.github.io#46 · 4 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 55/100
-
难度 2/5 1-3 小时 新手友好度 35/100
查看 hyperium/hyperium.github.io 的全部 Issue
相似的 Issue
-
automated issue report
难度 2/5 1-3 小时 新手友好度 75/100
-
Humanity AI 未关闭
难度 1/5 1 小时以内 新手友好度 90/100
numfocus/project-fundraising#166 ·
-
area:proxy bug security severity:low track:open-source
难度 2/5 1-3 小时 新手友好度 70/100