@@ -5,7 +5,7 @@ layout: guide
5
5
6
6
Let's start by making a "Hello, World!" server, and expand from there.
7
7
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 ` :
9
9
10
10
``` toml
11
11
[dependencies ]
@@ -43,7 +43,7 @@ incoming requests. It represents an async function that takes a
43
43
future is complete, it will resolve to a [ ` Response ` ] [ response ] or an error.
44
44
45
45
Hyper 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
47
47
a service from our ` hello ` function below when we're ready to start our
48
48
server.
49
49
@@ -67,7 +67,7 @@ set automatically.
67
67
68
68
## Starting the Server
69
69
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.
71
71
72
72
We'll dive in to the specifics of some of these things in another guide.
73
73
@@ -129,10 +129,21 @@ To see all the snippets put together, check out the [full example][example]!
129
129
Also, if ` service_fn ` doesn't meet your requirements and you'd like to implement
130
130
` Service ` yourself, see this [ example] [ impl service ] .
131
131
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
+
132
141
[ service] : {{ site.hyper_docs_url }}/hyper/service/trait.Service.html
133
142
[ service_fn] : {{ site.hyper_docs_url }}/hyper/service/fn.service_fn.html
134
143
[ request] : {{ site.hyper_docs_url }}/hyper/struct.Request.html
135
144
[ response] : {{ site.hyper_docs_url }}/hyper/struct.Response.html
136
145
[ parts] : {{ site.http_docs_url }}/http/response/struct.Parts.html
137
146
[ example] : {{ site.examples_url }}/hello.rs
147
+ [ example_http2] : {{ site.examples_url }}/hello-http2.rs
148
+ [ runtime ] : ../init/runtime.md
138
149
[ impl service] : {{ site.examples_url }}/service_struct_impl.rs
0 commit comments