-
Couldn't load subscription status.
- Fork 68
Open
@chiro-hiro
Description
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.
Metadata
Metadata
Assignees
Labels
No labels