Read body in the example server (#544)

Co-authored-by: Kornel Lesiński <kornel@cloudflare.com>
This commit is contained in:
Anthony Ramine
2021-05-06 20:42:29 +02:00
committed by GitHub
parent 5c72713e2a
commit fea3ae6ca9
2 changed files with 38 additions and 15 deletions

View File

@@ -182,9 +182,11 @@ pub struct Handshake<T, B: Buf = Bytes> {
/// # async fn doc<T: AsyncRead + AsyncWrite + Unpin>(my_io: T) {
/// let mut server = server::handshake(my_io).await.unwrap();
/// while let Some(request) = server.accept().await {
/// let (request, respond) = request.unwrap();
/// // Process the request and send the response back to the client
/// // using `respond`.
/// tokio::spawn(async move {
/// let (request, respond) = request.unwrap();
/// // Process the request and send the response back to the client
/// // using `respond`.
/// });
/// }
/// # }
/// #