Skip to content

Commit 2d226ef

Browse files
pchickeyysaito1001
andauthored
aws-smithy-wasm: add impl Default for WasiHttpClient (#4563)
## Motivation and Context Prior to this PR, the only way to construct a `WasiHttpClient` is via `WasiHttpClientBuilder::new().build()`. There are no other options on the Builder. The Builder exists to provide a surface for future expansion, and because #4498 was designed to minimize diff when changing the implementation behind the WasiHttpClient type. ## Description Adds `impl Default for WasiHttpClient` containing the trivial construction. ## Testing The existing test in `tools/ci-cdk/canary-wasm` has been modified to exercise this new constructor. ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [ ] For changes to the smithy-rs codegen or runtime crates, I have created a changelog entry Markdown file in the `.changelog` directory, specifying "client," "server," or both in the `applies_to` key. - [ ] For changes to the AWS SDK, generated SDK code, or SDK runtime crates, I have created a changelog entry Markdown file in the `.changelog` directory, specifying "aws-sdk-rust" in the `applies_to` key. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --------- Co-authored-by: ysaito1001 <awsaito@amazon.com>
1 parent 3d622d5 commit 2d226ef

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

rust-runtime/aws-smithy-wasm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-smithy-wasm"
3-
version = "0.1.10"
3+
version = "0.1.11"
44
authors = [
55
"AWS Rust SDK Team <aws-sdk-rust@amazon.com>",
66
"Eduardo Rodrigues <16357187+eduardomourar@users.noreply.github.com>",

rust-runtime/aws-smithy-wasm/src/wasi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl WasiHttpClientBuilder {
5757
/// An HTTP client that can be used during instantiation of the client SDK in
5858
/// order to route the HTTP requests through the WebAssembly host. The host must
5959
/// support the wasi-http interface as defined in the WASIp2 specification.
60-
#[derive(Debug, Clone)]
60+
#[derive(Debug, Default, Clone)]
6161
#[non_exhaustive]
6262
pub struct WasiHttpClient {}
6363

tools/ci-cdk/canary-wasm/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
use aws_config::Region;
77
use aws_sdk_s3 as s3;
8-
use aws_smithy_wasm::wasi::{WasiHttpClientBuilder, WasiSleep};
8+
use aws_smithy_wasm::wasi::{WasiHttpClient, WasiSleep};
99

1010
//Generates the Rust bindings from the wit file
1111
wit_bindgen::generate!({
@@ -23,7 +23,7 @@ impl exports::aws::component::canary_interface::Guest for Component {
2323
}
2424

2525
async fn run() -> Result<Vec<String>, String> {
26-
let http_client = WasiHttpClientBuilder::new().build();
26+
let http_client = WasiHttpClient::default();
2727
let sleep = WasiSleep;
2828
let config = aws_config::from_env()
2929
.region(Region::new("us-east-2"))

0 commit comments

Comments
 (0)