@@ -5,7 +5,7 @@ layout: guide
55
66Let's start by making a "Hello, World!" server, and expand from there.
77
8- First we need to declare our dependencies, let's add the following to our ` Cargo.toml ` :
8+ First, we need to declare our dependencies, let's add the following to our ` Cargo.toml ` :
99
1010``` toml
1111[dependencies ]
@@ -43,7 +43,7 @@ incoming requests. It represents an async function that takes a
4343future is complete, it will resolve to a [ ` Response ` ] [ response ] or an error.
4444
4545Hyper provides a utility for creating a ` Service ` from a function that should
46- serve most usecases : [ ` service_fn ` ] [ service_fn ] . We will use this to create
46+ serve most use cases : [ ` service_fn ` ] [ service_fn ] . We will use this to create
4747a service from our ` hello ` function below when we're ready to start our
4848server.
4949
@@ -67,7 +67,7 @@ set automatically.
6767
6868## Starting the Server
6969
70- Lastly, we need to hook up our ` hello ` service into a running hyper server.
70+ Lastly, we need to hook up our ` hello ` service into a running Hyper server.
7171
7272We'll dive in to the specifics of some of these things in another guide.
7373
@@ -129,10 +129,21 @@ To see all the snippets put together, check out the [full example][example]!
129129Also, if ` service_fn ` doesn't meet your requirements and you'd like to implement
130130` Service ` yourself, see this [ example] [ impl service ] .
131131
132+ ## HTTP/2
133+
134+ This example uses the ` http1 ` module to create a server that speaks HTTP/1.
135+ In case you want to use HTTP/2, you can use the ` http2 ` module with a few changes to the
136+ http1 server. The http2 builder requires an executor to run. Executor should implement the ` hyper::rt::Executor ` trait.
137+
138+ To implement the Executor, check out the runtime [ example] [ runtime ] .
139+ To see the full example with HTTP/2, check out the [ full example] [ example_http2 ] !
140+
132141[ service] : {{ site.hyper_docs_url }}/hyper/service/trait.Service.html
133142[ service_fn] : {{ site.hyper_docs_url }}/hyper/service/fn.service_fn.html
134143[ request] : {{ site.hyper_docs_url }}/hyper/struct.Request.html
135144[ response] : {{ site.hyper_docs_url }}/hyper/struct.Response.html
136145[ parts] : {{ site.http_docs_url }}/http/response/struct.Parts.html
137146[ example] : {{ site.examples_url }}/hello.rs
147+ [ example_http2] : {{ site.examples_url }}/hello-http2.rs
148+ [ runtime ] : ../init/runtime.md
138149[ impl service] : {{ site.examples_url }}/service_struct_impl.rs
0 commit comments