-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up re-exports and improve 'BuildError' conversions
- Loading branch information
Showing
15 changed files
with
134 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
use aws_sdk_dynamodb::error::SdkError; | ||
use aws_sdk_dynamodb::operation::create_table::CreateTableError; | ||
use aws_sdk_dynamodb::types::{KeySchemaElement, KeyType}; | ||
use aws_sdk_dynamodb::Client; | ||
|
||
#[allow(dead_code)] | ||
async fn create_table_test(client: &Client) -> Result<(), SdkError<CreateTableError>> { | ||
let _just_checking_compilation = client | ||
.create_table() | ||
.table_name("test") | ||
.key_schema( | ||
KeySchemaElement::builder() | ||
.attribute_name("year") | ||
.key_type(KeyType::Hash) | ||
.build()?, | ||
) | ||
.send() | ||
.await; | ||
Ok(()) | ||
} | ||
|
||
#[allow(dead_code)] | ||
async fn create_table_test_super_error(client: &Client) -> Result<(), aws_sdk_dynamodb::Error> { | ||
let _just_checking_compilation = client | ||
.create_table() | ||
.table_name("test") | ||
.key_schema( | ||
KeySchemaElement::builder() | ||
.attribute_name("year") | ||
.key_type(KeyType::Hash) | ||
.build()?, | ||
) | ||
.send() | ||
.await; | ||
Ok(()) | ||
} |
17 changes: 17 additions & 0 deletions
17
...ient/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientReExports.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package software.amazon.smithy.rust.codegen.client.smithy | ||
|
||
import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate | ||
import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType | ||
|
||
/** Returns a symbol for a type re-exported into crate::config | ||
* Although it is not always possible to use this, this is the preferred method for using types in config customizations | ||
* and ensures that your type will be re-exported if it is used. | ||
*/ | ||
fun configReexport(type: RuntimeType): RuntimeType = RuntimeType.forInlineFun(type.name, module = ClientRustModule.config) { | ||
rustTemplate("pub use #{type};", "type" to type) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.