Unverified Commit e84f48af authored by Declan Kelly's avatar Declan Kelly Committed by GitHub
Browse files

Derive Debug on all FluentBuilders (#377)



Add test and example code for Debug impl on fluent builders

Co-authored-by: default avatarRussell Cohen <rcoh@amazon.com>
parent 1abb0180
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ class FluentClientGenerator(protocolConfig: ProtocolConfig) {

                rust(
                    """
                ##[derive(std::fmt::Debug)]
                pub struct $name {
                    handle: std::sync::Arc<super::Handle>,
                    inner: #T
+6 −5
Original line number Diff line number Diff line
@@ -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
+8 −0
Original line number Diff line number Diff line
@@ -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() {
@@ -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()