mirror of
https://github.com/Noratrieb/icefun.git
synced 2026-01-14 12:55:02 +01:00
loop
This commit is contained in:
parent
0b89e245d9
commit
e1ebd97c91
73 changed files with 3822 additions and 3822 deletions
|
|
@ -82,42 +82,42 @@ where
|
|||
B1: HttpBody,
|
||||
B2: HttpBody,
|
||||
{}
|
||||
/// Create a `MakeService` from a function.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// # #[cfg(feature = "runtime")]
|
||||
/// # async fn run() {
|
||||
/// use std::convert::Infallible;
|
||||
/// use hyper::{Body, Request, Response, Server};
|
||||
/// use hyper::server::conn::AddrStream;
|
||||
/// use hyper::service::{make_service_fn, service_fn};
|
||||
///
|
||||
/// let addr = ([127, 0, 0, 1], 3000).into();
|
||||
///
|
||||
/// let make_svc = make_service_fn(|socket: &AddrStream| {
|
||||
/// let remote_addr = socket.remote_addr();
|
||||
/// async move {
|
||||
/// Ok::<_, Infallible>(service_fn(move |_: Request<Body>| async move {
|
||||
/// Ok::<_, Infallible>(
|
||||
/// Response::new(Body::from(format!("Hello, {}!", remote_addr)))
|
||||
/// )
|
||||
/// }))
|
||||
/// }
|
||||
/// });
|
||||
///
|
||||
/// // Then bind and serve...
|
||||
/// let server = Server::bind(&addr)
|
||||
/// .serve(make_svc);
|
||||
///
|
||||
/// // Finally, spawn `server` onto an Executor...
|
||||
/// if let Err(e) = server.await {
|
||||
/// eprintln!("server error: {}", e);
|
||||
/// }
|
||||
/// # }
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
pub fn make_service_fn<F, Target, Ret>(f: F) -> MakeServiceFn<F>
|
||||
where
|
||||
F: FnMut(&Target) -> Ret,
|
||||
|
|
@ -125,7 +125,7 @@ where
|
|||
{
|
||||
loop {}
|
||||
}
|
||||
/// `MakeService` returned from [`make_service_fn`]
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct MakeServiceFn<F> {
|
||||
f: F,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue