Skip to content

Commit

Permalink
Introduce generic fluent client generator to non-sdk codegen — take 2 (
Browse files Browse the repository at this point in the history
…#496)

* Implement Debug for more things

* Extract out generic hyper client to smithy-hyper

* Add generic fluent client generation

* Make the bounds nicer

* Make smithy-hyper hyper dep optional

* Rename smithy-hyper to smithy-client

* Enable rustls by default

* Also warn on rust 2018 idioms

* Add type-erased middleware

* Restore old DispatchLayer tracing

* Add connection type-erasure

* Fix rustdoc link

* Split up lib.rs

* Make Builder a little nicer to use

* Make aws_hyper simply wrap smithy_client

* Make it clear that bounds:: should never be implemented

* Finish adjusting aws fluent generator

* Make clippy happy

* Also re-expose test_connection in aws_hyper

* Make ktlint happy

* No Builder::native_tls with default features

Since the function "doesn't exist", we can't link to it. Arguably, the
docs should only be tested with all features enabled, but for now just
don't try to link to `native_tls`.

* Work around rustdoc bug

rust-lang/rust#72081

* Better names for type-erase methods

* Add middleware_fn

* Better docs for client

* Fix remaining erase_connector

* Better name for service in docs

* Correct send+sync test name

* Use crate name with _ in Rust code

* Fix up relative links

The standard syntax doesn't work:
rust-lang/rust#86120

* Fix the new integration test

* Hide temporary Operation type aliases

* Don't bound middleware_fn as it also bounds C

With the extra "helpful" bound, we also end up enforcing that C
implements Service, but since we're in a builder, C may not have been
set yet, and may be (), which in turn means that it isn't Service. So
users would end up with an error if they write:

    Builder::new().middleware_fn(|r| r).https().build()

but it would work with

    Builder::new().https().middleware_fn(|r| r).build()

which is silly.

* Don't recursive infinitely

* Can only doc(inline) re-exports, not type alises

* Can only doc(inline) re-exports, not type alises

Co-authored-by: Russell Cohen <rcoh@amazon.com>
  • Loading branch information
Jon Gjengset and rcoh authored Jun 11, 2021
1 parent c35c9fa commit 4ad0d22
Show file tree
Hide file tree
Showing 30 changed files with 2,007 additions and 399 deletions.
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-endpoint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pub fn set_endpoint_resolver(config: &mut PropertyBag, provider: AwsEndpointReso
/// 3. Apply the endpoint to the URI in the request
/// 4. Set the `SigningRegion` and `SigningService` in the property bag to drive downstream
/// signing middleware.
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct AwsEndpointStage;

#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-http/src/user_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl Display for ExecEnvMetadata {
}

#[non_exhaustive]
#[derive(Default, Clone)]
#[derive(Default, Clone, Debug)]
pub struct UserAgentStage;

impl UserAgentStage {
Expand Down
5 changes: 3 additions & 2 deletions aws/rust-runtime/aws-hyper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ license = "Apache-2.0"
[features]
test-util = ["protocol-test-helpers"]
default = ["test-util"]
native-tls = ["hyper-tls"]
rustls = ["hyper-rustls"]
native-tls = ["hyper-tls", "smithy-client/native-tls"]
rustls = ["hyper-rustls", "smithy-client/rustls"]

[dependencies]
hyper = { version = "0.14.2", features = ["client", "http1", "http2", "tcp", "runtime"] }
Expand All @@ -28,6 +28,7 @@ http-body = "0.4.0"
smithy-http = { path = "../../../rust-runtime/smithy-http" }
smithy-types = { path = "../../../rust-runtime/smithy-types" }
smithy-http-tower = { path = "../../../rust-runtime/smithy-http-tower" }
smithy-client = { path = "../../../rust-runtime/smithy-client" }
fastrand = "1.4.0"
tokio = { version = "1", features = ["time"] }

Expand Down
203 changes: 0 additions & 203 deletions aws/rust-runtime/aws-hyper/src/conn.rs

This file was deleted.

Loading

0 comments on commit 4ad0d22

Please sign in to comment.