@@ -18,9 +18,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
})?;
|
||||
|
||||
let project = std::env::args()
|
||||
.skip(1)
|
||||
.next()
|
||||
.ok_or("Expected a project name as the first argument.".to_string())?;
|
||||
.nth(1)
|
||||
.ok_or_else(|| "Expected a project name as the first argument.".to_string())?;
|
||||
|
||||
let bearer_token = format!("Bearer {}", token);
|
||||
let header_value = MetadataValue::from_str(&bearer_token)?;
|
||||
|
||||
@@ -48,12 +48,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!("GreeterServer listening on {}", addr);
|
||||
|
||||
let tonic = GreeterServer::new(greeter);
|
||||
let warp = warp::service(warp::path("hello").map(|| "hello, world!"));
|
||||
let mut warp = warp::service(warp::path("hello").map(|| "hello, world!"));
|
||||
|
||||
Server::bind(&addr)
|
||||
.serve(make_service_fn(move |_| {
|
||||
let mut tonic = tonic.clone();
|
||||
let mut warp = warp.clone();
|
||||
future::ok::<_, Infallible>(tower::service_fn(
|
||||
move |req: hyper::Request<hyper::Body>| match req.version() {
|
||||
Version::HTTP_11 | Version::HTTP_10 => Either::Left(
|
||||
|
||||
@@ -96,9 +96,7 @@ impl Echo for MyEcho {
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let addr = "[::1]:50051".parse().unwrap();
|
||||
|
||||
//println!("GreeterServer listening on {}", addr);
|
||||
|
||||
let warp = warp::service(warp::path("hello").map(|| "hello, world!"));
|
||||
let mut warp = warp::service(warp::path("hello").map(|| "hello, world!"));
|
||||
|
||||
Server::bind(&addr)
|
||||
.serve(make_service_fn(move |_| {
|
||||
@@ -110,7 +108,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.add_service(echo)
|
||||
.into_service();
|
||||
|
||||
let mut warp = warp.clone();
|
||||
future::ok::<_, Infallible>(tower::service_fn(
|
||||
move |req: hyper::Request<hyper::Body>| match req.version() {
|
||||
Version::HTTP_11 | Version::HTTP_10 => Either::Left(
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use std::collections::HashMap;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
@@ -150,17 +149,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Implement hash for Point
|
||||
impl Hash for Point {
|
||||
fn hash<H>(&self, state: &mut H)
|
||||
where
|
||||
H: Hasher,
|
||||
{
|
||||
self.latitude.hash(state);
|
||||
self.longitude.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Point {}
|
||||
|
||||
fn in_range(point: &Point, rect: &Rectangle) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user