Skip to content

Commit 80e9c1a

Browse files
author
David Barsky
committed
Corrected documentation on runtime client.
1 parent 628006c commit 80e9c1a

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

lambda-runtime-client/src/client.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ pub struct EventContext {
107107
pub identity: Option<CognitoIdentity>,
108108
}
109109

110-
/// The client SDK for Lambda's Runtime APIs that implements the `RuntimeClient` trait.
111-
/// This object is used by the `RustRuntime` to communicate with the internal endpoint.
110+
/// Used by the Runtime to communicate with the internal endpoint.
112111
pub struct RuntimeClient {
113112
_runtime: Runtime,
114113
http_client: Client<HttpConnector, Body>,
@@ -117,15 +116,7 @@ pub struct RuntimeClient {
117116

118117
impl RuntimeClient {
119118
/// Creates a new instance of the Runtime APIclient SDK. The http client has timeouts disabled and
120-
/// always send the `Connection: keep-alive` header.
121-
///
122-
/// # Arguments
123-
///
124-
/// * `http_endpoint` The http endpoint for the Runtime APIs. This value comes from the AWS_LAMBDA_RUNTIME_API
125-
/// environment variable.
126-
///
127-
/// # Return
128-
/// An instance of the Runtime APIs client SDK.
119+
/// will always send a `Connection: keep-alive` header.
129120
pub fn new(endpoint: String, runtime: Option<Runtime>) -> Result<Self, ApiError> {
130121
debug!("Starting new HttpRuntimeClient for {}", endpoint);
131122
// start a tokio core main event loop for hyper
@@ -145,10 +136,7 @@ impl RuntimeClient {
145136
}
146137

147138
impl RuntimeClient {
148-
/// Makes the HTTP call to poll for new events to the Runtime APIs.
149-
///
150-
/// # Return
151-
/// A `Result` containing a tuple of the new event of type `E` and its `EventContext`.
139+
/// Polls for new events to the Runtime APIs.
152140
pub fn next_event(&self) -> Result<(Vec<u8>, EventContext), ApiError> {
153141
let uri = format!(
154142
"http://{}/{}/runtime/invocation/next",

lambda-runtime-client/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#![warn(missing_docs)]
22
//! Rust client SDK for the AWS Lambda Runtime APIs. This crate defines
3-
//! both a `RuntimeClient` trait and it's implementation: `HttpRuntimeClient`.
4-
//! The `HttpRuntimeClient` object exposes all of the methods available in
5-
//! AWS Lambda's Runtime APIs and it can be used to build any rust-related
6-
//! custom runtime in Lambda.
3+
//! a `RuntimeClient` that encapsulates interactions with AWS Lambda's Runtime
4+
//! APIs.
75
//!
86
//! To return errors to the Runtime APIs through the `event_error()` or
97
//! `fail_init()` methods the `Error` objects must implement the `error::RuntimeApiError`
@@ -33,7 +31,7 @@
3331
//!
3432
//! fn main() {
3533
//! let runtime_endpoint = String::from("http://localhost:8080");
36-
//! let client: &RuntimeClient = &HttpRuntimeClient::new(runtime_endpoint, None)
34+
//! let client = RuntimeClient::new(runtime_endpoint, None)
3735
//! .expect("Could not initialize client");
3836
//!
3937
//! let (event_data, event_context) = client.next_event()

0 commit comments

Comments
 (0)