|
1 |
| -use error::{ApiError, ErrorResponse, RuntimeApiError}; |
| 1 | +use std::{collections::HashMap, fmt}; |
| 2 | + |
2 | 3 | use hyper::{
|
3 | 4 | client::HttpConnector,
|
4 | 5 | header::{self, HeaderMap, HeaderValue},
|
5 | 6 | rt::{Future, Stream},
|
6 | 7 | Body, Client, Method, Request, Uri,
|
7 | 8 | };
|
| 9 | +use serde_derive::Deserialize; |
8 | 10 | use serde_json;
|
9 |
| -use std::{collections::HashMap, fmt}; |
10 | 11 | use tokio::runtime::Runtime;
|
11 | 12 |
|
| 13 | +use crate::error::{ApiError, ErrorResponse, RuntimeApiError}; |
| 14 | + |
12 | 15 | const RUNTIME_API_VERSION: &str = "2018-06-01";
|
13 | 16 | const API_CONTENT_TYPE: &str = "application/json";
|
14 | 17 | const API_ERROR_CONTENT_TYPE: &str = "application/vnd.aws.lambda.error+json";
|
@@ -48,7 +51,7 @@ impl LambdaHeaders {
|
48 | 51 | }
|
49 | 52 |
|
50 | 53 | impl fmt::Display for LambdaHeaders {
|
51 |
| - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 54 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
52 | 55 | f.write_str(self.as_str())
|
53 | 56 | }
|
54 | 57 | }
|
@@ -257,7 +260,7 @@ impl RuntimeClient {
|
257 | 260 | ///
|
258 | 261 | /// # Returns
|
259 | 262 | /// A `Result` object containing a bool return value for the call or an `error::ApiError` instance.
|
260 |
| - pub fn event_error(&self, request_id: &str, e: &RuntimeApiError) -> Result<(), ApiError> { |
| 263 | + pub fn event_error(&self, request_id: &str, e: &dyn RuntimeApiError) -> Result<(), ApiError> { |
261 | 264 | let uri: Uri = format!(
|
262 | 265 | "http://{}/{}/runtime/invocation/{}/error",
|
263 | 266 | self.endpoint, RUNTIME_API_VERSION, request_id
|
@@ -304,7 +307,7 @@ impl RuntimeClient {
|
304 | 307 | /// # Panics
|
305 | 308 | /// If it cannot send the init error. In this case we panic to force the runtime
|
306 | 309 | /// to restart.
|
307 |
| - pub fn fail_init(&self, e: &RuntimeApiError) { |
| 310 | + pub fn fail_init(&self, e: &dyn RuntimeApiError) { |
308 | 311 | let uri: Uri = format!("http://{}/{}/runtime/init/error", self.endpoint, RUNTIME_API_VERSION)
|
309 | 312 | .parse()
|
310 | 313 | .expect("Could not generate Runtime URI");
|
|
0 commit comments