Skip to content

Commit

Permalink
Derive Debug on all FluentBuilders (#377)
Browse files Browse the repository at this point in the history
Add test and example code for Debug impl on fluent builders

Co-authored-by: Russell Cohen <[email protected]>
  • Loading branch information
declanvk and rcoh authored May 17, 2021
1 parent 1abb018 commit e84f48a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class FluentClientGenerator(protocolConfig: ProtocolConfig) {

rust(
"""
##[derive(std::fmt::Debug)]
pub struct $name {
handle: std::sync::Arc<super::Handle>,
inner: #T
Expand Down
11 changes: 6 additions & 5 deletions aws/sdk/examples/dynamo-add-item/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,18 @@ async fn main() {
let first_av = AttributeValue::S(String::from(&first));
let last_av = AttributeValue::S(String::from(&last));

match client
let request = client
.put_item()
.table_name(table)
.item("username", user_av)
.item("account_type", type_av)
.item("age", age_av)
.item("first_name", first_av)
.item("last_name", last_av)
.send()
.await
{
.item("last_name", last_av);

println!("Executing request [{:?}] to add item...", request);

match request.send().await {
Ok(_) => println!(
"Added user {}, {} {}, age {} as {} user",
username, first, last, age, p_type
Expand Down
8 changes: 8 additions & 0 deletions aws/sdk/integration-tests/kms/tests/sensitive-it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ fn validate_sensitive_trait() {

fn assert_send_sync<T: Send + Sync + 'static>() {}
fn assert_send_fut<T: Send + 'static>(_: T) {}
fn assert_debug<T: std::fmt::Debug>() {}

#[test]
fn types_are_send_sync() {
Expand All @@ -54,6 +55,13 @@ fn client_is_clone() {
let _ = client.clone();
}

#[test]
fn types_are_debug() {
assert_debug::<kms::Client>();
assert_debug::<kms::client::fluent_builders::GenerateRandom>();
assert_debug::<kms::client::fluent_builders::CreateAlias>();
}

fn create_alias_op() -> Parts<CreateAlias, AwsErrorRetryPolicy> {
let conf = kms::Config::builder().build();
let (_, parts) = CreateAlias::builder()
Expand Down

0 comments on commit e84f48a

Please sign in to comment.