Add server docs

This commit is contained in:
Lucio Franco
2019-09-04 16:38:46 -04:00
parent 2a01ab229a
commit 77a6c89ae9
8 changed files with 107 additions and 13 deletions
-1
View File
@@ -24,7 +24,6 @@ path = "src/routeguide/client.rs"
[dependencies]
tonic = { path = "../tonic" }
hyper = { git = "https://github.com/hyperium/hyper" }
futures-preview = { version = "=0.3.0-alpha.18", default-features = false, features = ["alloc"]}
tokio = "=0.2.0-alpha.4"
prost = "0.5"
+3 -4
View File
@@ -1,12 +1,12 @@
mod data;
use futures::{Stream, StreamExt};
use hyper::Server;
use std::collections::HashMap;
use std::hash::{Hash, Hasher};
use std::sync::Arc;
use std::time::Instant;
use tokio::sync::{mpsc, Lock};
use tonic::transport::Server;
use tonic::{Request, Response, Status};
pub mod routeguide {
@@ -159,9 +159,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
},
};
Server::bind(&addr)
.http2_only(true)
.serve(RouteGuideServer::new(route_guide))
Server::builder()
.serve(addr, RouteGuideServer::new(route_guide))
.await?;
Ok(())