Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_complex_struct_operation_output.rs

@@ -1,1 +100,185 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborSerializerGenerator.kt:228 */
    2      3   
pub fn ser_complex_struct_operation_output_output_output(
    3      4   
    value: &crate::output::ComplexStructOperationOutput,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::vec::Vec<u8>,
    6      7   
    ::aws_smithy_types::error::operation::SerializationError,
    7      8   
> {
           9  +
    /* CborSerializerGenerator.kt:233 */
    8     10   
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
          11  +
    /* CborSerializerGenerator.kt:235 */
    9     12   
    {
          13  +
        /* CborSerializerGenerator.kt:236 */
   10     14   
        let encoder = &mut encoder;
          15  +
        /* CborSerializerGenerator.kt:403 */
   11     16   
        crate::protocol_serde::shape_complex_struct_operation_output::ser_complex_struct_operation_output_output(encoder, value )?;
          17  +
        /* CborSerializerGenerator.kt:235 */
   12     18   
    }
          19  +
    /* CborSerializerGenerator.kt:242 */
   13     20   
    ::std::result::Result::Ok(encoder.into_writer())
          21  +
    /* CborSerializerGenerator.kt:228 */
   14     22   
}
   15     23   
          24  +
/* CborSerializerGenerator.kt:369 */
   16     25   
pub fn ser_complex_struct_operation_output_output(
   17     26   
    encoder: &mut ::aws_smithy_cbor::Encoder,
   18     27   
    #[allow(unused)] input: &crate::output::ComplexStructOperationOutput,
   19     28   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          29  +
    /* CborSerializerGenerator.kt:377 */
   20     30   
    encoder.begin_map();
          31  +
    /* CborSerializerGenerator.kt:414 */
   21     32   
    if let Some(var_1) = &input.structure {
          33  +
        /* CborSerializerGenerator.kt:486 */
   22     34   
        encoder.str("structure");
          35  +
        /* CborSerializerGenerator.kt:403 */
   23     36   
        crate::protocol_serde::shape_simple_struct::ser_simple_struct(encoder, var_1)?;
          37  +
        /* CborSerializerGenerator.kt:414 */
   24     38   
    }
          39  +
    /* CborSerializerGenerator.kt:414 */
   25     40   
    if let Some(var_2) = &input.empty_structure {
          41  +
        /* CborSerializerGenerator.kt:486 */
   26     42   
        encoder.str("emptyStructure");
          43  +
        /* CborSerializerGenerator.kt:403 */
   27     44   
        crate::protocol_serde::shape_empty_struct::ser_empty_struct(encoder, var_2)?;
          45  +
        /* CborSerializerGenerator.kt:414 */
   28     46   
    }
          47  +
    /* CborSerializerGenerator.kt:414 */
   29     48   
    if let Some(var_3) = &input.list {
          49  +
        /* CborSerializerGenerator.kt:486 */
   30     50   
        encoder.str("list");
          51  +
        /* CborSerializerGenerator.kt:504 */
   31     52   
        encoder.array((*var_3).len());
          53  +
        /* CborSerializerGenerator.kt:506 */
   32     54   
        for item_4 in var_3 {
          55  +
            /* SerializerUtil.kt:42 */
   33     56   
            {
          57  +
                /* CborSerializerGenerator.kt:462 */
   34     58   
                encoder.str(item_4.as_str());
          59  +
                /* SerializerUtil.kt:42 */
   35     60   
            }
          61  +
            /* CborSerializerGenerator.kt:506 */
   36     62   
        }
          63  +
        /* CborSerializerGenerator.kt:414 */
   37     64   
    }
          65  +
    /* CborSerializerGenerator.kt:414 */
   38     66   
    if let Some(var_5) = &input.map {
          67  +
        /* CborSerializerGenerator.kt:486 */
   39     68   
        encoder.str("map");
          69  +
        /* CborSerializerGenerator.kt:517 */
   40     70   
        encoder.map((*var_5).len());
          71  +
        /* CborSerializerGenerator.kt:518 */
   41     72   
        for (key_6, value_7) in var_5 {
          73  +
            /* SerializerUtil.kt:42 */
   42     74   
            {
          75  +
                /* CborSerializerGenerator.kt:466 */
   43     76   
                encoder.str(key_6.as_str()).integer(*value_7);
          77  +
                /* SerializerUtil.kt:42 */
   44     78   
            }
          79  +
            /* CborSerializerGenerator.kt:518 */
   45     80   
        }
          81  +
        /* CborSerializerGenerator.kt:414 */
   46     82   
    }
          83  +
    /* CborSerializerGenerator.kt:414 */
   47     84   
    if let Some(var_8) = &input.union {
          85  +
        /* CborSerializerGenerator.kt:486 */
   48     86   
        encoder.str("union");
          87  +
        /* CborSerializerGenerator.kt:571 */
   49     88   
        crate::protocol_serde::shape_simple_union::ser_simple_union(encoder, var_8)?;
          89  +
        /* CborSerializerGenerator.kt:414 */
   50     90   
    }
          91  +
    /* CborSerializerGenerator.kt:414 */
   51     92   
    if let Some(var_9) = &input.unit_union {
          93  +
        /* CborSerializerGenerator.kt:486 */
   52     94   
        encoder.str("unitUnion");
          95  +
        /* CborSerializerGenerator.kt:571 */
   53     96   
        crate::protocol_serde::shape_unit_union::ser_unit_union(encoder, var_9)?;
          97  +
        /* CborSerializerGenerator.kt:414 */
   54     98   
    }
          99  +
    /* CborSerializerGenerator.kt:414 */
   55    100   
    if let Some(var_10) = &input.structure_list {
         101  +
        /* CborSerializerGenerator.kt:486 */
   56    102   
        encoder.str("structureList");
         103  +
        /* CborSerializerGenerator.kt:504 */
   57    104   
        encoder.array((*var_10).len());
         105  +
        /* CborSerializerGenerator.kt:506 */
   58    106   
        for item_11 in var_10 {
         107  +
            /* SerializerUtil.kt:42 */
   59    108   
            {
         109  +
                /* CborSerializerGenerator.kt:403 */
   60    110   
                crate::protocol_serde::shape_simple_struct::ser_simple_struct(encoder, item_11)?;
         111  +
                /* SerializerUtil.kt:42 */
   61    112   
            }
         113  +
            /* CborSerializerGenerator.kt:506 */
   62    114   
        }
         115  +
        /* CborSerializerGenerator.kt:414 */
   63    116   
    }
         117  +
    /* SerializerUtil.kt:42 */
   64    118   
    {
         119  +
        /* CborSerializerGenerator.kt:486 */
   65    120   
        encoder.str("complexList");
         121  +
        /* CborSerializerGenerator.kt:504 */
   66    122   
        encoder.array((input.complex_list).len());
         123  +
        /* CborSerializerGenerator.kt:506 */
   67    124   
        for item_12 in &input.complex_list {
         125  +
            /* SerializerUtil.kt:42 */
   68    126   
            {
         127  +
                /* CborSerializerGenerator.kt:517 */
   69    128   
                encoder.map((*item_12).len());
         129  +
                /* CborSerializerGenerator.kt:518 */
   70    130   
                for (key_13, value_14) in item_12 {
         131  +
                    /* SerializerUtil.kt:42 */
   71    132   
                    {
         133  +
                        /* CborSerializerGenerator.kt:486 */
   72    134   
                        encoder.str(key_13.as_str());
         135  +
                        /* CborSerializerGenerator.kt:571 */
   73    136   
                        crate::protocol_serde::shape_complex_union::ser_complex_union(
   74    137   
                            encoder, value_14,
   75    138   
                        )?;
         139  +
                        /* SerializerUtil.kt:42 */
   76    140   
                    }
         141  +
                    /* CborSerializerGenerator.kt:518 */
   77    142   
                }
         143  +
                /* SerializerUtil.kt:42 */
   78    144   
            }
         145  +
            /* CborSerializerGenerator.kt:506 */
   79    146   
        }
         147  +
        /* SerializerUtil.kt:42 */
   80    148   
    }
         149  +
    /* SerializerUtil.kt:42 */
   81    150   
    {
         151  +
        /* CborSerializerGenerator.kt:486 */
   82    152   
        encoder.str("complexMap");
         153  +
        /* CborSerializerGenerator.kt:517 */
   83    154   
        encoder.map((input.complex_map).len());
         155  +
        /* CborSerializerGenerator.kt:518 */
   84    156   
        for (key_15, value_16) in &input.complex_map {
         157  +
            /* SerializerUtil.kt:42 */
   85    158   
            {
         159  +
                /* CborSerializerGenerator.kt:486 */
   86    160   
                encoder.str(key_15.as_str());
         161  +
                /* CborSerializerGenerator.kt:571 */
   87    162   
                crate::protocol_serde::shape_complex_union::ser_complex_union(encoder, value_16)?;
         163  +
                /* SerializerUtil.kt:42 */
   88    164   
            }
         165  +
            /* CborSerializerGenerator.kt:518 */
   89    166   
        }
         167  +
        /* SerializerUtil.kt:42 */
   90    168   
    }
         169  +
    /* SerializerUtil.kt:42 */
   91    170   
    {
         171  +
        /* CborSerializerGenerator.kt:486 */
   92    172   
        encoder.str("complexUnion");
         173  +
        /* CborSerializerGenerator.kt:571 */
   93    174   
        crate::protocol_serde::shape_complex_union::ser_complex_union(
   94    175   
            encoder,
   95    176   
            &input.complex_union,
   96    177   
        )?;
         178  +
        /* SerializerUtil.kt:42 */
   97    179   
    }
         180  +
    /* CborSerializerGenerator.kt:393 */
   98    181   
    encoder.end();
         182  +
    /* CborSerializerGenerator.kt:394 */
   99    183   
    Ok(())
         184  +
    /* CborSerializerGenerator.kt:369 */
  100    185   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_complex_union.rs

@@ -1,1 +95,151 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:749 */
    2      3   
pub(crate) fn de_complex_union(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained,
    6      7   
    ::aws_smithy_cbor::decode::DeserializeError,
    7      8   
> {
    8      9   
    fn pair(
    9     10   
        decoder: &mut ::aws_smithy_cbor::Decoder,
   10     11   
    ) -> ::std::result::Result<
   11     12   
        crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained,
   12     13   
        ::aws_smithy_cbor::decode::DeserializeError,
   13     14   
    > {
   14     15   
        Ok(match decoder.str()?.as_ref() {
   15     16   
    "complexStruct" => crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::ComplexStruct(
   16     17   
        crate::protocol_serde::shape_complex_struct::de_complex_struct(decoder)
   17     18   
    ?),
   18     19   
    "structure" => crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::Structure(
   19     20   
        crate::protocol_serde::shape_simple_struct::de_simple_struct(decoder)
   20     21   
    ?),
   21     22   
    "list" => crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::List(
   22     23   
        crate::protocol_serde::shape_simple_list::de_simple_list(decoder)
   23     24   
    ?),
   24     25   
    "map" => crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::Map(
   25     26   
        crate::protocol_serde::shape_simple_map::de_simple_map(decoder)
   26     27   
    ?),
   27     28   
    "union" => crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::Union(
   28     29   
        crate::protocol_serde::shape_simple_union::de_simple_union(decoder)
   29     30   
    ?),
   30     31   
    variant => return Err(::aws_smithy_cbor::decode::DeserializeError::unknown_union_variant(variant, decoder.position()))
   31     32   
    })
   32     33   
    }
   33     34   
   34     35   
    match decoder.map()? {
   35     36   
        None => {
   36     37   
            let variant = pair(decoder)?;
   37     38   
            match decoder.datatype()? {
   38     39   
                ::aws_smithy_cbor::data::Type::Break => {
   39     40   
                    decoder.skip()?;
   40     41   
                    Ok(variant)
   41     42   
                }
   42     43   
                ty => Err(
   43     44   
                    ::aws_smithy_cbor::decode::DeserializeError::unexpected_union_variant(
   44     45   
                        ty,
   45     46   
                        decoder.position(),
   46     47   
                    ),
   47     48   
                ),
   48     49   
            }
   49     50   
        }
   50     51   
        Some(1) => pair(decoder),
   51     52   
        Some(_) => Err(
   52     53   
            ::aws_smithy_cbor::decode::DeserializeError::mixed_union_variants(decoder.position()),
   53     54   
        ),
   54     55   
    }
   55     56   
}
   56     57   
          58  +
/* CborSerializerGenerator.kt:528 */
   57     59   
pub fn ser_complex_union(
   58     60   
    encoder: &mut ::aws_smithy_cbor::Encoder,
   59     61   
    input: &crate::model::ComplexUnion,
   60     62   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          63  +
    /* CborSerializerGenerator.kt:545 */
   61     64   
    encoder.map(1);
          65  +
    /* CborSerializerGenerator.kt:548 */
   62     66   
    match input {
          67  +
        /* CborSerializerGenerator.kt:556 */
   63     68   
        crate::model::ComplexUnion::ComplexStruct(inner) => {
          69  +
            /* SerializerUtil.kt:42 */
          70  +
            {
          71  +
                /* CborSerializerGenerator.kt:486 */
   64     72   
                encoder.str("complexStruct");
          73  +
                /* CborSerializerGenerator.kt:403 */
   65     74   
                crate::protocol_serde::shape_complex_struct::ser_complex_struct(encoder, inner)?;
          75  +
                /* SerializerUtil.kt:42 */
          76  +
            }
          77  +
            /* CborSerializerGenerator.kt:556 */
   66     78   
        }
          79  +
        /* CborSerializerGenerator.kt:556 */
   67     80   
        crate::model::ComplexUnion::Structure(inner) => {
          81  +
            /* SerializerUtil.kt:42 */
          82  +
            {
          83  +
                /* CborSerializerGenerator.kt:486 */
   68     84   
                encoder.str("structure");
          85  +
                /* CborSerializerGenerator.kt:403 */
   69     86   
                crate::protocol_serde::shape_simple_struct::ser_simple_struct(encoder, inner)?;
          87  +
                /* SerializerUtil.kt:42 */
   70     88   
            }
          89  +
            /* CborSerializerGenerator.kt:556 */
          90  +
        }
          91  +
        /* CborSerializerGenerator.kt:556 */
   71     92   
        crate::model::ComplexUnion::List(inner) => {
          93  +
            /* SerializerUtil.kt:42 */
          94  +
            {
          95  +
                /* CborSerializerGenerator.kt:486 */
   72     96   
                encoder.str("list");
          97  +
                /* CborSerializerGenerator.kt:504 */
   73     98   
                encoder.array((*inner).len());
          99  +
                /* CborSerializerGenerator.kt:506 */
   74    100   
                for item_1 in inner {
         101  +
                    /* SerializerUtil.kt:42 */
   75    102   
                    {
         103  +
                        /* CborSerializerGenerator.kt:462 */
   76    104   
                        encoder.str(item_1.as_str());
         105  +
                        /* SerializerUtil.kt:42 */
   77    106   
                    }
         107  +
                    /* CborSerializerGenerator.kt:506 */
   78    108   
                }
         109  +
                /* SerializerUtil.kt:42 */
   79    110   
            }
         111  +
            /* CborSerializerGenerator.kt:556 */
         112  +
        }
         113  +
        /* CborSerializerGenerator.kt:556 */
   80    114   
        crate::model::ComplexUnion::Map(inner) => {
         115  +
            /* SerializerUtil.kt:42 */
         116  +
            {
         117  +
                /* CborSerializerGenerator.kt:486 */
   81    118   
                encoder.str("map");
         119  +
                /* CborSerializerGenerator.kt:517 */
   82    120   
                encoder.map((*inner).len());
         121  +
                /* CborSerializerGenerator.kt:518 */
   83    122   
                for (key_2, value_3) in inner {
         123  +
                    /* SerializerUtil.kt:42 */
   84    124   
                    {
         125  +
                        /* CborSerializerGenerator.kt:466 */
   85    126   
                        encoder.str(key_2.as_str()).integer(*value_3);
         127  +
                        /* SerializerUtil.kt:42 */
   86    128   
                    }
         129  +
                    /* CborSerializerGenerator.kt:518 */
   87    130   
                }
         131  +
                /* SerializerUtil.kt:42 */
   88    132   
            }
         133  +
            /* CborSerializerGenerator.kt:556 */
         134  +
        }
         135  +
        /* CborSerializerGenerator.kt:556 */
   89    136   
        crate::model::ComplexUnion::Union(inner) => {
         137  +
            /* SerializerUtil.kt:42 */
         138  +
            {
         139  +
                /* CborSerializerGenerator.kt:486 */
   90    140   
                encoder.str("union");
         141  +
                /* CborSerializerGenerator.kt:571 */
   91    142   
                crate::protocol_serde::shape_simple_union::ser_simple_union(encoder, inner)?;
         143  +
                /* SerializerUtil.kt:42 */
   92    144   
            }
         145  +
            /* CborSerializerGenerator.kt:556 */
         146  +
        } /* CborSerializerGenerator.kt:548 */
   93    147   
    }
         148  +
    /* CborSerializerGenerator.kt:568 */
   94    149   
    ::std::result::Result::Ok(())
         150  +
    /* CborSerializerGenerator.kt:528 */
   95    151   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_empty_struct.rs

@@ -1,1 +55,67 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:692 */
    2      3   
pub(crate) fn de_empty_struct(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<crate::model::EmptyStruct, ::aws_smithy_cbor::decode::DeserializeError> {
           6  +
    /* CborParserGenerator.kt:700 */
    5      7   
    #[allow(clippy::match_single_binding)]
    6      8   
    fn pair(
    7      9   
        mut builder: crate::model::empty_struct::Builder,
    8     10   
        decoder: &mut ::aws_smithy_cbor::Decoder,
    9     11   
    ) -> ::std::result::Result<
   10     12   
        crate::model::empty_struct::Builder,
   11     13   
        ::aws_smithy_cbor::decode::DeserializeError,
   12     14   
    > {
   13     15   
        builder = match decoder.str()?.as_ref() {
   14     16   
            _ => {
   15     17   
                decoder.skip()?;
   16     18   
                builder
   17     19   
            }
   18     20   
        };
   19     21   
        Ok(builder)
   20     22   
    }
   21     23   
   22     24   
    let mut builder = crate::model::empty_struct::Builder::default();
   23     25   
   24     26   
    match decoder.map()? {
   25     27   
        None => loop {
   26     28   
            match decoder.datatype()? {
   27     29   
                ::aws_smithy_cbor::data::Type::Break => {
   28     30   
                    decoder.skip()?;
   29     31   
                    break;
   30     32   
                }
   31     33   
                _ => {
   32     34   
                    builder = pair(builder, decoder)?;
   33     35   
                }
   34     36   
            };
   35     37   
        },
   36     38   
        Some(n) => {
   37     39   
            for _ in 0..n {
   38     40   
                builder = pair(builder, decoder)?;
   39     41   
            }
   40     42   
        }
   41     43   
    };
          44  +
    /* CborParserGenerator.kt:726 */
   42     45   
    #[allow(clippy::needless_question_mark)]
          46  +
    /* CborParserGenerator.kt:727 */
   43     47   
    {
          48  +
        /* CborParserGenerator.kt:728 */
   44     49   
        return Ok(builder.build());
          50  +
        /* CborParserGenerator.kt:727 */
   45     51   
    }
          52  +
    /* CborParserGenerator.kt:692 */
   46     53   
}
   47     54   
          55  +
/* CborSerializerGenerator.kt:369 */
   48     56   
pub fn ser_empty_struct(
   49     57   
    encoder: &mut ::aws_smithy_cbor::Encoder,
   50     58   
    #[allow(unused)] input: &crate::model::EmptyStruct,
   51     59   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          60  +
    /* CborSerializerGenerator.kt:377 */
   52     61   
    encoder.begin_map();
          62  +
    /* CborSerializerGenerator.kt:393 */
   53     63   
    encoder.end();
          64  +
    /* CborSerializerGenerator.kt:394 */
   54     65   
    Ok(())
          66  +
    /* CborSerializerGenerator.kt:369 */
   55     67   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_empty_struct_operation.rs

@@ -1,1 +60,84 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_empty_struct_operation_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::EmptyStructOperationInput,
    7      9   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::empty_struct_operation_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   22     30   
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   23     32   
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   24     34   
}
   25     35   
          36  +
/* RustType.kt:516 */
   26     37   
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   27     39   
pub fn ser_empty_struct_operation_http_response(
   28     40   
    #[allow(unused_variables)] output: crate::output::EmptyStructOperationOutput,
   29     41   
) -> std::result::Result<
   30     42   
    ::aws_smithy_http_server::response::Response,
   31     43   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   32     44   
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   33     46   
    Ok({
          47  +
        /* RustType.kt:516 */
   34     48   
        #[allow(unused_mut)]
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   35     50   
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   36     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   37     53   
            builder,
   38     54   
            ::http::header::CONTENT_TYPE,
   39     55   
            "application/cbor",
   40     56   
        );
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   41     58   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   42     59   
            builder,
   43     60   
            ::http::header::HeaderName::from_static("smithy-protocol"),
   44     61   
            "rpc-v2-cbor",
   45     62   
        );
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   46     64   
        let http_status: u16 = 200;
   47     65   
        builder = builder.status(http_status);
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   48     67   
        let payload =
   49         -
            crate::protocol_serde::shape_empty_struct_operation_output::ser_empty_struct_operation_output_output_output(&output)?
   50         -
        ;
          68  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_empty_struct_operation_output::ser_empty_struct_operation_output_output_output(&output)?
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   51     71   
        let content_length = payload.len();
   52     72   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   53     73   
            builder,
   54     74   
            ::http::header::CONTENT_LENGTH,
   55     75   
            content_length,
   56     76   
        );
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   57     78   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   58     80   
        builder.body(body)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   59     82   
    })
          83  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   60     84   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_empty_struct_operation_output.rs

@@ -1,1 +23,36 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborSerializerGenerator.kt:228 */
    2      3   
pub fn ser_empty_struct_operation_output_output_output(
    3      4   
    value: &crate::output::EmptyStructOperationOutput,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::vec::Vec<u8>,
    6      7   
    ::aws_smithy_types::error::operation::SerializationError,
    7      8   
> {
           9  +
    /* CborSerializerGenerator.kt:233 */
    8     10   
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
          11  +
    /* CborSerializerGenerator.kt:235 */
    9     12   
    {
          13  +
        /* CborSerializerGenerator.kt:236 */
   10     14   
        let encoder = &mut encoder;
          15  +
        /* CborSerializerGenerator.kt:403 */
   11     16   
        crate::protocol_serde::shape_empty_struct_operation_output::ser_empty_struct_operation_output_output(encoder, value )?;
          17  +
        /* CborSerializerGenerator.kt:235 */
   12     18   
    }
          19  +
    /* CborSerializerGenerator.kt:242 */
   13     20   
    ::std::result::Result::Ok(encoder.into_writer())
          21  +
    /* CborSerializerGenerator.kt:228 */
   14     22   
}
   15     23   
          24  +
/* CborSerializerGenerator.kt:369 */
   16     25   
pub fn ser_empty_struct_operation_output_output(
   17     26   
    encoder: &mut ::aws_smithy_cbor::Encoder,
   18     27   
    #[allow(unused)] input: &crate::output::EmptyStructOperationOutput,
   19     28   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          29  +
    /* CborSerializerGenerator.kt:377 */
   20     30   
    encoder.begin_map();
          31  +
    /* CborSerializerGenerator.kt:393 */
   21     32   
    encoder.end();
          33  +
    /* CborSerializerGenerator.kt:394 */
   22     34   
    Ok(())
          35  +
    /* CborSerializerGenerator.kt:369 */
   23     36   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_error_serialization_operation.rs

@@ -1,1 +136,180 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_error_serialization_operation_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::ErrorSerializationOperationInput,
    7      9   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::error_serialization_operation_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/cbor"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_error_serialization_operation::de_error_serialization_operation(bytes.as_ref(), input)?;
          39  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   29     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   30     42   
        input.build()?
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   31     44   
    })
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   32     46   
}
   33     47   
          48  +
/* RustType.kt:516 */
   34     49   
#[allow(clippy::unnecessary_wraps)]
          50  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   35     51   
pub fn ser_error_serialization_operation_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::ErrorSerializationOperationOutput,
   37     53   
) -> std::result::Result<
   38     54   
    ::aws_smithy_http_server::response::Response,
   39     55   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   40     56   
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   41     58   
    Ok({
          59  +
        /* RustType.kt:516 */
   42     60   
        #[allow(unused_mut)]
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   43     62   
        let mut builder = ::http::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     64   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     65   
            builder,
   46     66   
            ::http::header::CONTENT_TYPE,
   47     67   
            "application/cbor",
   48     68   
        );
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   49     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     71   
            builder,
   51     72   
            ::http::header::HeaderName::from_static("smithy-protocol"),
   52     73   
            "rpc-v2-cbor",
   53     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   54     76   
        let http_status: u16 = 200;
   55     77   
        builder = builder.status(http_status);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   56     79   
        let payload =
   57         -
            crate::protocol_serde::shape_error_serialization_operation_output::ser_error_serialization_operation_output_output_output(&output)?
   58         -
        ;
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_error_serialization_operation_output::ser_error_serialization_operation_output_output_output(&output)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   59     83   
        let content_length = payload.len();
   60     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     85   
            builder,
   62     86   
            ::http::header::CONTENT_LENGTH,
   63     87   
            content_length,
   64     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   65     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   66     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   67     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   68     96   
}
   69     97   
          98  +
/* RustType.kt:516 */
   70     99   
#[allow(clippy::unnecessary_wraps)]
         100  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   71    101   
pub fn ser_error_serialization_operation_http_error(
   72    102   
    error: &crate::error::ErrorSerializationOperationError,
   73    103   
) -> std::result::Result<
   74    104   
    ::aws_smithy_http_server::response::Response,
   75    105   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   76    106   
> {
         107  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   77    108   
    Ok({
         109  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   78    110   
        match error {
         111  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   79    112   
            crate::error::ErrorSerializationOperationError::ValidationException(output) => {
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   80    114   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         115  +
                /* RustType.kt:516 */
   81    116   
                #[allow(unused_mut)]
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   82    118   
                let mut builder = ::http::Response::builder();
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   83    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    121   
                    builder,
   85    122   
                    ::http::header::CONTENT_TYPE,
   86    123   
                    "application/cbor",
   87    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   88    126   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89    127   
                    builder,
   90    128   
                    ::http::header::HeaderName::from_static("smithy-protocol"),
   91    129   
                    "rpc-v2-cbor",
   92    130   
                );
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   93    132   
                let content_length = payload.len();
   94    133   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   95    134   
                    builder,
   96    135   
                    ::http::header::CONTENT_LENGTH,
   97    136   
                    content_length,
   98    137   
                );
         138  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   99    139   
                builder
  100    140   
                    .status(400)
  101    141   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         142  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         143  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  102    144   
        }
  103         -
        }
         145  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  104    146   
    })
         147  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  105    148   
}
  106    149   
         150  +
/* CborParserGenerator.kt:482 */
  107    151   
pub(crate) fn de_error_serialization_operation(
  108    152   
    value: &[u8],
  109    153   
    mut builder: crate::input::error_serialization_operation_input::Builder,
  110    154   
) -> ::std::result::Result<
  111    155   
    crate::input::error_serialization_operation_input::Builder,
  112    156   
    ::aws_smithy_cbor::decode::DeserializeError,
  113    157   
> {
  114    158   
    #[allow(clippy::match_single_binding)]
  115    159   
    fn pair(
  116    160   
        mut builder: crate::input::error_serialization_operation_input::Builder,

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_error_serialization_operation_output.rs

@@ -1,1 +29,46 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborSerializerGenerator.kt:228 */
    2      3   
pub fn ser_error_serialization_operation_output_output_output(
    3      4   
    value: &crate::output::ErrorSerializationOperationOutput,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::vec::Vec<u8>,
    6      7   
    ::aws_smithy_types::error::operation::SerializationError,
    7      8   
> {
           9  +
    /* CborSerializerGenerator.kt:233 */
    8     10   
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
          11  +
    /* CborSerializerGenerator.kt:235 */
    9     12   
    {
          13  +
        /* CborSerializerGenerator.kt:236 */
   10     14   
        let encoder = &mut encoder;
          15  +
        /* CborSerializerGenerator.kt:403 */
   11     16   
        crate::protocol_serde::shape_error_serialization_operation_output::ser_error_serialization_operation_output_output(encoder, value )?;
          17  +
        /* CborSerializerGenerator.kt:235 */
   12     18   
    }
          19  +
    /* CborSerializerGenerator.kt:242 */
   13     20   
    ::std::result::Result::Ok(encoder.into_writer())
          21  +
    /* CborSerializerGenerator.kt:228 */
   14     22   
}
   15     23   
          24  +
/* CborSerializerGenerator.kt:369 */
   16     25   
pub fn ser_error_serialization_operation_output_output(
   17     26   
    encoder: &mut ::aws_smithy_cbor::Encoder,
   18     27   
    #[allow(unused)] input: &crate::output::ErrorSerializationOperationOutput,
   19     28   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          29  +
    /* CborSerializerGenerator.kt:377 */
   20     30   
    encoder.begin_map();
          31  +
    /* CborSerializerGenerator.kt:414 */
   21     32   
    if let Some(var_1) = &input.error_shape {
          33  +
        /* CborSerializerGenerator.kt:486 */
   22     34   
        encoder.str("errorShape");
          35  +
        /* CborSerializerGenerator.kt:403 */
   23     36   
        crate::protocol_serde::shape_validation_exception::ser_validation_exception(
   24     37   
            encoder, var_1,
   25     38   
        )?;
          39  +
        /* CborSerializerGenerator.kt:414 */
   26     40   
    }
          41  +
    /* CborSerializerGenerator.kt:393 */
   27     42   
    encoder.end();
          43  +
    /* CborSerializerGenerator.kt:394 */
   28     44   
    Ok(())
          45  +
    /* CborSerializerGenerator.kt:369 */
   29     46   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_simple_list.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:616 */
    2      3   
pub(crate) fn de_simple_list(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::vec::Vec<::std::string::String>,
    6      7   
    ::aws_smithy_cbor::decode::DeserializeError,
    7      8   
> {
    8      9   
    fn member(
    9     10   
        mut list: ::std::vec::Vec<::std::string::String>,
   10     11   
        decoder: &mut ::aws_smithy_cbor::Decoder,
   11     12   
    ) -> ::std::result::Result<

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_simple_map.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:659 */
    2      3   
pub(crate) fn de_simple_map(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::collections::HashMap<::std::string::String, i32>,
    6      7   
    ::aws_smithy_cbor::decode::DeserializeError,
    7      8   
> {
    8      9   
    fn pair(
    9     10   
        mut map: ::std::collections::HashMap<::std::string::String, i32>,
   10     11   
        decoder: &mut ::aws_smithy_cbor::Decoder,
   11     12   
    ) -> ::std::result::Result<

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_simple_struct.rs

@@ -1,1 +37,39 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:692 */
    2      3   
pub(crate) fn de_simple_struct(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    crate::model::simple_struct::Builder,
    6      7   
    ::aws_smithy_cbor::decode::DeserializeError,
    7      8   
> {
           9  +
    /* CborParserGenerator.kt:700 */
    8     10   
    #[allow(clippy::match_single_binding)]
    9     11   
    fn pair(
   10     12   
        mut builder: crate::model::simple_struct::Builder,
   11     13   
        decoder: &mut ::aws_smithy_cbor::Decoder,
   12     14   
    ) -> ::std::result::Result<
   13     15   
        crate::model::simple_struct::Builder,
   14     16   
        ::aws_smithy_cbor::decode::DeserializeError,
   15     17   
    > {
   16     18   
        builder = match decoder.str()?.as_ref() {
   17     19   
            "blob" => {
@@ -81,83 +197,272 @@
  101    103   
                    builder = pair(builder, decoder)?;
  102    104   
                }
  103    105   
            };
  104    106   
        },
  105    107   
        Some(n) => {
  106    108   
            for _ in 0..n {
  107    109   
                builder = pair(builder, decoder)?;
  108    110   
            }
  109    111   
        }
  110    112   
    };
         113  +
    /* CborParserGenerator.kt:716 */
  111    114   
    Ok(builder)
         115  +
    /* CborParserGenerator.kt:692 */
  112    116   
}
  113    117   
         118  +
/* CborSerializerGenerator.kt:369 */
  114    119   
pub fn ser_simple_struct(
  115    120   
    encoder: &mut ::aws_smithy_cbor::Encoder,
  116    121   
    #[allow(unused)] input: &crate::model::SimpleStruct,
  117    122   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         123  +
    /* CborSerializerGenerator.kt:377 */
  118    124   
    encoder.begin_map();
         125  +
    /* CborSerializerGenerator.kt:414 */
  119    126   
    if let Some(var_1) = &input.blob {
         127  +
        /* CborSerializerGenerator.kt:459 */
  120    128   
        encoder.str("blob").blob(var_1);
         129  +
        /* CborSerializerGenerator.kt:414 */
  121    130   
    }
         131  +
    /* CborSerializerGenerator.kt:414 */
  122    132   
    if let Some(var_2) = &input.boolean {
         133  +
        /* CborSerializerGenerator.kt:460 */
  123    134   
        encoder.str("boolean").boolean(*var_2);
         135  +
        /* CborSerializerGenerator.kt:414 */
  124    136   
    }
         137  +
    /* CborSerializerGenerator.kt:414 */
  125    138   
    if let Some(var_3) = &input.string {
         139  +
        /* CborSerializerGenerator.kt:462 */
  126    140   
        encoder.str("string").str(var_3.as_str());
         141  +
        /* CborSerializerGenerator.kt:414 */
  127    142   
    }
         143  +
    /* CborSerializerGenerator.kt:414 */
  128    144   
    if let Some(var_4) = &input.byte {
         145  +
        /* CborSerializerGenerator.kt:464 */
  129    146   
        encoder.str("byte").byte(*var_4);
         147  +
        /* CborSerializerGenerator.kt:414 */
  130    148   
    }
         149  +
    /* CborSerializerGenerator.kt:414 */
  131    150   
    if let Some(var_5) = &input.short {
         151  +
        /* CborSerializerGenerator.kt:465 */
  132    152   
        encoder.str("short").short(*var_5);
         153  +
        /* CborSerializerGenerator.kt:414 */
  133    154   
    }
         155  +
    /* CborSerializerGenerator.kt:414 */
  134    156   
    if let Some(var_6) = &input.integer {
         157  +
        /* CborSerializerGenerator.kt:466 */
  135    158   
        encoder.str("integer").integer(*var_6);
         159  +
        /* CborSerializerGenerator.kt:414 */
  136    160   
    }
         161  +
    /* CborSerializerGenerator.kt:414 */
  137    162   
    if let Some(var_7) = &input.long {
         163  +
        /* CborSerializerGenerator.kt:467 */
  138    164   
        encoder.str("long").long(*var_7);
         165  +
        /* CborSerializerGenerator.kt:414 */
  139    166   
    }
         167  +
    /* CborSerializerGenerator.kt:414 */
  140    168   
    if let Some(var_8) = &input.float {
         169  +
        /* CborSerializerGenerator.kt:469 */
  141    170   
        encoder.str("float").float(*var_8);
         171  +
        /* CborSerializerGenerator.kt:414 */
  142    172   
    }
         173  +
    /* CborSerializerGenerator.kt:414 */
  143    174   
    if let Some(var_9) = &input.double {
         175  +
        /* CborSerializerGenerator.kt:470 */
  144    176   
        encoder.str("double").double(*var_9);
         177  +
        /* CborSerializerGenerator.kt:414 */
  145    178   
    }
         179  +
    /* CborSerializerGenerator.kt:414 */
  146    180   
    if let Some(var_10) = &input.timestamp {
         181  +
        /* CborSerializerGenerator.kt:472 */
  147    182   
        encoder.str("timestamp").timestamp(var_10);
         183  +
        /* CborSerializerGenerator.kt:414 */
  148    184   
    }
         185  +
    /* CborSerializerGenerator.kt:414 */
  149    186   
    if let Some(var_11) = &input.r#enum {
         187  +
        /* CborSerializerGenerator.kt:462 */
  150    188   
        encoder.str("enum").str(var_11.as_str());
         189  +
        /* CborSerializerGenerator.kt:414 */
  151    190   
    }
         191  +
    /* SerializerUtil.kt:42 */
  152    192   
    {
         193  +
        /* CborSerializerGenerator.kt:459 */
  153    194   
        encoder.str("requiredBlob").blob(&input.required_blob);
         195  +
        /* SerializerUtil.kt:42 */
  154    196   
    }
         197  +
    /* SerializerUtil.kt:42 */
  155    198   
    {
         199  +
        /* CborSerializerGenerator.kt:460 */
  156    200   
        encoder
  157    201   
            .str("requiredBoolean")
  158    202   
            .boolean(input.required_boolean);
         203  +
        /* SerializerUtil.kt:42 */
  159    204   
    }
         205  +
    /* SerializerUtil.kt:42 */
  160    206   
    {
         207  +
        /* CborSerializerGenerator.kt:462 */
  161    208   
        encoder
  162    209   
            .str("requiredString")
  163    210   
            .str(input.required_string.as_str());
         211  +
        /* SerializerUtil.kt:42 */
  164    212   
    }
         213  +
    /* SerializerUtil.kt:42 */
  165    214   
    {
         215  +
        /* CborSerializerGenerator.kt:464 */
  166    216   
        encoder.str("requiredByte").byte(input.required_byte);
         217  +
        /* SerializerUtil.kt:42 */
  167    218   
    }
         219  +
    /* SerializerUtil.kt:42 */
  168    220   
    {
         221  +
        /* CborSerializerGenerator.kt:465 */
  169    222   
        encoder.str("requiredShort").short(input.required_short);
         223  +
        /* SerializerUtil.kt:42 */
  170    224   
    }
         225  +
    /* SerializerUtil.kt:42 */
  171    226   
    {
         227  +
        /* CborSerializerGenerator.kt:466 */
  172    228   
        encoder
  173    229   
            .str("requiredInteger")
  174    230   
            .integer(input.required_integer);
         231  +
        /* SerializerUtil.kt:42 */
  175    232   
    }
         233  +
    /* SerializerUtil.kt:42 */
  176    234   
    {
         235  +
        /* CborSerializerGenerator.kt:467 */
  177    236   
        encoder.str("requiredLong").long(input.required_long);
         237  +
        /* SerializerUtil.kt:42 */
  178    238   
    }
         239  +
    /* SerializerUtil.kt:42 */
  179    240   
    {
         241  +
        /* CborSerializerGenerator.kt:469 */
  180    242   
        encoder.str("requiredFloat").float(input.required_float);
         243  +
        /* SerializerUtil.kt:42 */
  181    244   
    }
         245  +
    /* SerializerUtil.kt:42 */
  182    246   
    {
         247  +
        /* CborSerializerGenerator.kt:470 */
  183    248   
        encoder.str("requiredDouble").double(input.required_double);
         249  +
        /* SerializerUtil.kt:42 */
  184    250   
    }
         251  +
    /* SerializerUtil.kt:42 */
  185    252   
    {
         253  +
        /* CborSerializerGenerator.kt:472 */
  186    254   
        encoder
  187    255   
            .str("requiredTimestamp")
  188    256   
            .timestamp(&input.required_timestamp);
         257  +
        /* SerializerUtil.kt:42 */
  189    258   
    }
         259  +
    /* SerializerUtil.kt:42 */
  190    260   
    {
         261  +
        /* CborSerializerGenerator.kt:462 */
  191    262   
        encoder
  192    263   
            .str("requiredEnum")
  193    264   
            .str(input.required_enum.as_str());
         265  +
        /* SerializerUtil.kt:42 */
  194    266   
    }
         267  +
    /* CborSerializerGenerator.kt:393 */
  195    268   
    encoder.end();
         269  +
    /* CborSerializerGenerator.kt:394 */
  196    270   
    Ok(())
         271  +
    /* CborSerializerGenerator.kt:369 */
  197    272   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_simple_struct_operation.rs

@@ -1,1 +140,184 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_simple_struct_operation_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::SimpleStructOperationInput,
    7      9   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::simple_struct_operation_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/cbor"),
   27     37   
            )?;
   28     38   
            input =
   29     39   
                crate::protocol_serde::shape_simple_struct_operation::de_simple_struct_operation(
   30     40   
                    bytes.as_ref(),
   31     41   
                    input,
   32     42   
                )?;
          43  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   33     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     46   
        input.build()?
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     48   
    })
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     50   
}
   37     51   
          52  +
/* RustType.kt:516 */
   38     53   
#[allow(clippy::unnecessary_wraps)]
          54  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     55   
pub fn ser_simple_struct_operation_http_response(
   40     56   
    #[allow(unused_variables)] output: crate::output::SimpleStructOperationOutput,
   41     57   
) -> std::result::Result<
   42     58   
    ::aws_smithy_http_server::response::Response,
   43     59   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   44     60   
> {
          61  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     62   
    Ok({
          63  +
        /* RustType.kt:516 */
   46     64   
        #[allow(unused_mut)]
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     66   
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   48     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     69   
            builder,
   50     70   
            ::http::header::CONTENT_TYPE,
   51     71   
            "application/cbor",
   52     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   53     74   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   54     75   
            builder,
   55     76   
            ::http::header::HeaderName::from_static("smithy-protocol"),
   56     77   
            "rpc-v2-cbor",
   57     78   
        );
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   58     80   
        let http_status: u16 = 200;
   59     81   
        builder = builder.status(http_status);
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   60     83   
        let payload =
   61         -
            crate::protocol_serde::shape_simple_struct_operation_output::ser_simple_struct_operation_output_output_output(&output)?
   62         -
        ;
          84  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_simple_struct_operation_output::ser_simple_struct_operation_output_output_output(&output)?
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   63     87   
        let content_length = payload.len();
   64     88   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   65     89   
            builder,
   66     90   
            ::http::header::CONTENT_LENGTH,
   67     91   
            content_length,
   68     92   
        );
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   69     94   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   70     96   
        builder.body(body)?
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   71     98   
    })
          99  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   72    100   
}
   73    101   
         102  +
/* RustType.kt:516 */
   74    103   
#[allow(clippy::unnecessary_wraps)]
         104  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   75    105   
pub fn ser_simple_struct_operation_http_error(
   76    106   
    error: &crate::error::SimpleStructOperationError,
   77    107   
) -> std::result::Result<
   78    108   
    ::aws_smithy_http_server::response::Response,
   79    109   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   80    110   
> {
         111  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   81    112   
    Ok({
         113  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   82    114   
        match error {
         115  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   83    116   
            crate::error::SimpleStructOperationError::ValidationException(output) => {
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   84    118   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         119  +
                /* RustType.kt:516 */
   85    120   
                #[allow(unused_mut)]
         121  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   86    122   
                let mut builder = ::http::Response::builder();
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   87    124   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   88    125   
                    builder,
   89    126   
                    ::http::header::CONTENT_TYPE,
   90    127   
                    "application/cbor",
   91    128   
                );
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   92    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    131   
                    builder,
   94    132   
                    ::http::header::HeaderName::from_static("smithy-protocol"),
   95    133   
                    "rpc-v2-cbor",
   96    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   97    136   
                let content_length = payload.len();
   98    137   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   99    138   
                    builder,
  100    139   
                    ::http::header::CONTENT_LENGTH,
  101    140   
                    content_length,
  102    141   
                );
         142  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  103    143   
                builder
  104    144   
                    .status(400)
  105    145   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         146  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         147  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  106    148   
        }
  107         -
        }
         149  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  108    150   
    })
         151  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  109    152   
}
  110    153   
         154  +
/* CborParserGenerator.kt:482 */
  111    155   
pub(crate) fn de_simple_struct_operation(
  112    156   
    value: &[u8],
  113    157   
    mut builder: crate::input::simple_struct_operation_input::Builder,
  114    158   
) -> ::std::result::Result<
  115    159   
    crate::input::simple_struct_operation_input::Builder,
  116    160   
    ::aws_smithy_cbor::decode::DeserializeError,
  117    161   
> {
  118    162   
    #[allow(clippy::match_single_binding)]
  119    163   
    fn pair(
  120    164   
        mut builder: crate::input::simple_struct_operation_input::Builder,

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_simple_struct_operation_output.rs

@@ -1,1 +99,178 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborSerializerGenerator.kt:228 */
    2      3   
pub fn ser_simple_struct_operation_output_output_output(
    3      4   
    value: &crate::output::SimpleStructOperationOutput,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::vec::Vec<u8>,
    6      7   
    ::aws_smithy_types::error::operation::SerializationError,
    7      8   
> {
           9  +
    /* CborSerializerGenerator.kt:233 */
    8     10   
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
          11  +
    /* CborSerializerGenerator.kt:235 */
    9     12   
    {
          13  +
        /* CborSerializerGenerator.kt:236 */
   10     14   
        let encoder = &mut encoder;
          15  +
        /* CborSerializerGenerator.kt:403 */
   11     16   
        crate::protocol_serde::shape_simple_struct_operation_output::ser_simple_struct_operation_output_output(encoder, value )?;
          17  +
        /* CborSerializerGenerator.kt:235 */
   12     18   
    }
          19  +
    /* CborSerializerGenerator.kt:242 */
   13     20   
    ::std::result::Result::Ok(encoder.into_writer())
          21  +
    /* CborSerializerGenerator.kt:228 */
   14     22   
}
   15     23   
          24  +
/* CborSerializerGenerator.kt:369 */
   16     25   
pub fn ser_simple_struct_operation_output_output(
   17     26   
    encoder: &mut ::aws_smithy_cbor::Encoder,
   18     27   
    #[allow(unused)] input: &crate::output::SimpleStructOperationOutput,
   19     28   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          29  +
    /* CborSerializerGenerator.kt:377 */
   20     30   
    encoder.begin_map();
          31  +
    /* CborSerializerGenerator.kt:414 */
   21     32   
    if let Some(var_1) = &input.blob {
          33  +
        /* CborSerializerGenerator.kt:459 */
   22     34   
        encoder.str("blob").blob(var_1);
          35  +
        /* CborSerializerGenerator.kt:414 */
   23     36   
    }
          37  +
    /* CborSerializerGenerator.kt:414 */
   24     38   
    if let Some(var_2) = &input.boolean {
          39  +
        /* CborSerializerGenerator.kt:460 */
   25     40   
        encoder.str("boolean").boolean(*var_2);
          41  +
        /* CborSerializerGenerator.kt:414 */
   26     42   
    }
          43  +
    /* CborSerializerGenerator.kt:414 */
   27     44   
    if let Some(var_3) = &input.string {
          45  +
        /* CborSerializerGenerator.kt:462 */
   28     46   
        encoder.str("string").str(var_3.as_str());
          47  +
        /* CborSerializerGenerator.kt:414 */
   29     48   
    }
          49  +
    /* CborSerializerGenerator.kt:414 */
   30     50   
    if let Some(var_4) = &input.byte {
          51  +
        /* CborSerializerGenerator.kt:464 */
   31     52   
        encoder.str("byte").byte(*var_4);
          53  +
        /* CborSerializerGenerator.kt:414 */
   32     54   
    }
          55  +
    /* CborSerializerGenerator.kt:414 */
   33     56   
    if let Some(var_5) = &input.short {
          57  +
        /* CborSerializerGenerator.kt:465 */
   34     58   
        encoder.str("short").short(*var_5);
          59  +
        /* CborSerializerGenerator.kt:414 */
   35     60   
    }
          61  +
    /* CborSerializerGenerator.kt:414 */
   36     62   
    if let Some(var_6) = &input.integer {
          63  +
        /* CborSerializerGenerator.kt:466 */
   37     64   
        encoder.str("integer").integer(*var_6);
          65  +
        /* CborSerializerGenerator.kt:414 */
   38     66   
    }
          67  +
    /* CborSerializerGenerator.kt:414 */
   39     68   
    if let Some(var_7) = &input.long {
          69  +
        /* CborSerializerGenerator.kt:467 */
   40     70   
        encoder.str("long").long(*var_7);
          71  +
        /* CborSerializerGenerator.kt:414 */
   41     72   
    }
          73  +
    /* CborSerializerGenerator.kt:414 */
   42     74   
    if let Some(var_8) = &input.float {
          75  +
        /* CborSerializerGenerator.kt:469 */
   43     76   
        encoder.str("float").float(*var_8);
          77  +
        /* CborSerializerGenerator.kt:414 */
   44     78   
    }
          79  +
    /* CborSerializerGenerator.kt:414 */
   45     80   
    if let Some(var_9) = &input.double {
          81  +
        /* CborSerializerGenerator.kt:470 */
   46     82   
        encoder.str("double").double(*var_9);
          83  +
        /* CborSerializerGenerator.kt:414 */
   47     84   
    }
          85  +
    /* CborSerializerGenerator.kt:414 */
   48     86   
    if let Some(var_10) = &input.timestamp {
          87  +
        /* CborSerializerGenerator.kt:472 */
   49     88   
        encoder.str("timestamp").timestamp(var_10);
          89  +
        /* CborSerializerGenerator.kt:414 */
   50     90   
    }
          91  +
    /* CborSerializerGenerator.kt:414 */
   51     92   
    if let Some(var_11) = &input.r#enum {
          93  +
        /* CborSerializerGenerator.kt:462 */
   52     94   
        encoder.str("enum").str(var_11.as_str());
          95  +
        /* CborSerializerGenerator.kt:414 */
   53     96   
    }
          97  +
    /* SerializerUtil.kt:42 */
   54     98   
    {
          99  +
        /* CborSerializerGenerator.kt:459 */
   55    100   
        encoder.str("requiredBlob").blob(&input.required_blob);
         101  +
        /* SerializerUtil.kt:42 */
   56    102   
    }
         103  +
    /* SerializerUtil.kt:42 */
   57    104   
    {
         105  +
        /* CborSerializerGenerator.kt:460 */
   58    106   
        encoder
   59    107   
            .str("requiredBoolean")
   60    108   
            .boolean(input.required_boolean);
         109  +
        /* SerializerUtil.kt:42 */
   61    110   
    }
         111  +
    /* SerializerUtil.kt:42 */
   62    112   
    {
         113  +
        /* CborSerializerGenerator.kt:462 */
   63    114   
        encoder
   64    115   
            .str("requiredString")
   65    116   
            .str(input.required_string.as_str());
         117  +
        /* SerializerUtil.kt:42 */
   66    118   
    }
         119  +
    /* SerializerUtil.kt:42 */
   67    120   
    {
         121  +
        /* CborSerializerGenerator.kt:464 */
   68    122   
        encoder.str("requiredByte").byte(input.required_byte);
         123  +
        /* SerializerUtil.kt:42 */
   69    124   
    }
         125  +
    /* SerializerUtil.kt:42 */
   70    126   
    {
         127  +
        /* CborSerializerGenerator.kt:465 */
   71    128   
        encoder.str("requiredShort").short(input.required_short);
         129  +
        /* SerializerUtil.kt:42 */
   72    130   
    }
         131  +
    /* SerializerUtil.kt:42 */
   73    132   
    {
         133  +
        /* CborSerializerGenerator.kt:466 */
   74    134   
        encoder
   75    135   
            .str("requiredInteger")
   76    136   
            .integer(input.required_integer);
         137  +
        /* SerializerUtil.kt:42 */
   77    138   
    }
         139  +
    /* SerializerUtil.kt:42 */
   78    140   
    {
         141  +
        /* CborSerializerGenerator.kt:467 */
   79    142   
        encoder.str("requiredLong").long(input.required_long);
         143  +
        /* SerializerUtil.kt:42 */
   80    144   
    }
         145  +
    /* SerializerUtil.kt:42 */
   81    146   
    {
         147  +
        /* CborSerializerGenerator.kt:469 */
   82    148   
        encoder.str("requiredFloat").float(input.required_float);
         149  +
        /* SerializerUtil.kt:42 */
   83    150   
    }
         151  +
    /* SerializerUtil.kt:42 */
   84    152   
    {
         153  +
        /* CborSerializerGenerator.kt:470 */
   85    154   
        encoder.str("requiredDouble").double(input.required_double);
         155  +
        /* SerializerUtil.kt:42 */
   86    156   
    }
         157  +
    /* SerializerUtil.kt:42 */
   87    158   
    {
         159  +
        /* CborSerializerGenerator.kt:472 */
   88    160   
        encoder
   89    161   
            .str("requiredTimestamp")
   90    162   
            .timestamp(&input.required_timestamp);
         163  +
        /* SerializerUtil.kt:42 */
   91    164   
    }
         165  +
    /* SerializerUtil.kt:42 */
   92    166   
    {
         167  +
        /* CborSerializerGenerator.kt:462 */
   93    168   
        encoder
   94    169   
            .str("requiredEnum")
   95    170   
            .str(input.required_enum.as_str());
         171  +
        /* SerializerUtil.kt:42 */
   96    172   
    }
         173  +
    /* CborSerializerGenerator.kt:393 */
   97    174   
    encoder.end();
         175  +
    /* CborSerializerGenerator.kt:394 */
   98    176   
    Ok(())
         177  +
    /* CborSerializerGenerator.kt:369 */
   99    178   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_simple_union.rs

@@ -1,1 +73,109 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:749 */
    2      3   
pub(crate) fn de_simple_union(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<crate::model::SimpleUnion, ::aws_smithy_cbor::decode::DeserializeError> {
    5      6   
    fn pair(
    6      7   
        decoder: &mut ::aws_smithy_cbor::Decoder,
    7      8   
    ) -> ::std::result::Result<crate::model::SimpleUnion, ::aws_smithy_cbor::decode::DeserializeError>
    8      9   
    {
    9     10   
        Ok(match decoder.str()?.as_ref() {
   10     11   
            "blob" => crate::model::SimpleUnion::Blob(decoder.blob()?),
   11     12   
            "boolean" => crate::model::SimpleUnion::Boolean(decoder.boolean()?),
   12     13   
            "string" => crate::model::SimpleUnion::String(decoder.string()?),
   13     14   
            "unit" => {
   14     15   
                decoder.skip()?;
   15     16   
                crate::model::SimpleUnion::Unit
   16     17   
            }
   17     18   
            variant => {
   18     19   
                return Err(
   19     20   
                    ::aws_smithy_cbor::decode::DeserializeError::unknown_union_variant(
   20     21   
                        variant,
   21     22   
                        decoder.position(),
   22     23   
                    ),
   23     24   
                )
   24     25   
            }
   25     26   
        })
   26     27   
    }
   27     28   
   28     29   
    match decoder.map()? {
   29     30   
        None => {
   30     31   
            let variant = pair(decoder)?;
   31     32   
            match decoder.datatype()? {
   32     33   
                ::aws_smithy_cbor::data::Type::Break => {
   33     34   
                    decoder.skip()?;
   34     35   
                    Ok(variant)
   35     36   
                }
   36     37   
                ty => Err(
   37     38   
                    ::aws_smithy_cbor::decode::DeserializeError::unexpected_union_variant(
   38     39   
                        ty,
   39     40   
                        decoder.position(),
   40     41   
                    ),
   41     42   
                ),
   42     43   
            }
   43     44   
        }
   44     45   
        Some(1) => pair(decoder),
   45     46   
        Some(_) => Err(
   46     47   
            ::aws_smithy_cbor::decode::DeserializeError::mixed_union_variants(decoder.position()),
   47     48   
        ),
   48     49   
    }
   49     50   
}
   50     51   
          52  +
/* CborSerializerGenerator.kt:528 */
   51     53   
pub fn ser_simple_union(
   52     54   
    encoder: &mut ::aws_smithy_cbor::Encoder,
   53     55   
    input: &crate::model::SimpleUnion,
   54     56   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          57  +
    /* CborSerializerGenerator.kt:545 */
   55     58   
    encoder.map(1);
          59  +
    /* CborSerializerGenerator.kt:548 */
   56     60   
    match input {
          61  +
        /* CborSerializerGenerator.kt:556 */
   57     62   
        crate::model::SimpleUnion::Blob(inner) => {
          63  +
            /* SerializerUtil.kt:42 */
          64  +
            {
          65  +
                /* CborSerializerGenerator.kt:459 */
   58     66   
                encoder.str("blob").blob(inner);
          67  +
                /* SerializerUtil.kt:42 */
          68  +
            }
          69  +
            /* CborSerializerGenerator.kt:556 */
   59     70   
        }
          71  +
        /* CborSerializerGenerator.kt:556 */
   60     72   
        crate::model::SimpleUnion::Boolean(inner) => {
          73  +
            /* SerializerUtil.kt:42 */
          74  +
            {
          75  +
                /* CborSerializerGenerator.kt:460 */
   61     76   
                encoder.str("boolean").boolean(*inner);
          77  +
                /* SerializerUtil.kt:42 */
          78  +
            }
          79  +
            /* CborSerializerGenerator.kt:556 */
   62     80   
        }
          81  +
        /* CborSerializerGenerator.kt:556 */
   63     82   
        crate::model::SimpleUnion::String(inner) => {
          83  +
            /* SerializerUtil.kt:42 */
          84  +
            {
          85  +
                /* CborSerializerGenerator.kt:462 */
   64     86   
                encoder.str("string").str(inner.as_str());
          87  +
                /* SerializerUtil.kt:42 */
          88  +
            }
          89  +
            /* CborSerializerGenerator.kt:556 */
   65     90   
        }
          91  +
        /* CborSerializerGenerator.kt:556 */
   66     92   
        crate::model::SimpleUnion::Unit => {
          93  +
            /* SerializerUtil.kt:42 */
          94  +
            {
          95  +
                /* CborSerializerGenerator.kt:486 */
   67     96   
                encoder.str("unit");
          97  +
                /* CborSerializerGenerator.kt:348 */
   68     98   
                encoder.begin_map();
          99  +
                /* CborSerializerGenerator.kt:358 */
   69    100   
                encoder.end();
         101  +
                /* SerializerUtil.kt:42 */
   70    102   
            }
         103  +
            /* CborSerializerGenerator.kt:556 */
         104  +
        } /* CborSerializerGenerator.kt:548 */
   71    105   
    }
         106  +
    /* CborSerializerGenerator.kt:568 */
   72    107   
    ::std::result::Result::Ok(())
         108  +
    /* CborSerializerGenerator.kt:528 */
   73    109   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_single_member_struct_operation.rs

@@ -1,1 +99,128 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_single_member_struct_operation_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::SingleMemberStructOperationInput,
    7      9   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::single_member_struct_operation_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/cbor"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_single_member_struct_operation::de_single_member_struct_operation(bytes.as_ref(), input)?;
          39  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   29     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   30     42   
        input.build()
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   31     44   
    })
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   32     46   
}
   33     47   
          48  +
/* RustType.kt:516 */
   34     49   
#[allow(clippy::unnecessary_wraps)]
          50  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   35     51   
pub fn ser_single_member_struct_operation_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::SingleMemberStructOperationOutput,
   37     53   
) -> std::result::Result<
   38     54   
    ::aws_smithy_http_server::response::Response,
   39     55   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   40     56   
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   41     58   
    Ok({
          59  +
        /* RustType.kt:516 */
   42     60   
        #[allow(unused_mut)]
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   43     62   
        let mut builder = ::http::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     64   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     65   
            builder,
   46     66   
            ::http::header::CONTENT_TYPE,
   47     67   
            "application/cbor",
   48     68   
        );
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   49     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     71   
            builder,
   51     72   
            ::http::header::HeaderName::from_static("smithy-protocol"),
   52     73   
            "rpc-v2-cbor",
   53     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   54     76   
        let http_status: u16 = 200;
   55     77   
        builder = builder.status(http_status);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   56     79   
        let payload =
   57         -
            crate::protocol_serde::shape_single_member_struct_operation_output::ser_single_member_struct_operation_output_output_output(&output)?
   58         -
        ;
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_single_member_struct_operation_output::ser_single_member_struct_operation_output_output_output(&output)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   59     83   
        let content_length = payload.len();
   60     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     85   
            builder,
   62     86   
            ::http::header::CONTENT_LENGTH,
   63     87   
            content_length,
   64     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   65     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   66     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   67     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   68     96   
}
   69     97   
          98  +
/* CborParserGenerator.kt:482 */
   70     99   
pub(crate) fn de_single_member_struct_operation(
   71    100   
    value: &[u8],
   72    101   
    mut builder: crate::input::single_member_struct_operation_input::Builder,
   73    102   
) -> ::std::result::Result<
   74    103   
    crate::input::single_member_struct_operation_input::Builder,
   75    104   
    ::aws_smithy_cbor::decode::DeserializeError,
   76    105   
> {
   77    106   
    #[allow(clippy::match_single_binding)]
   78    107   
    fn pair(
   79    108   
        mut builder: crate::input::single_member_struct_operation_input::Builder,

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_single_member_struct_operation_output.rs

@@ -1,1 +26,42 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborSerializerGenerator.kt:228 */
    2      3   
pub fn ser_single_member_struct_operation_output_output_output(
    3      4   
    value: &crate::output::SingleMemberStructOperationOutput,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::vec::Vec<u8>,
    6      7   
    ::aws_smithy_types::error::operation::SerializationError,
    7      8   
> {
           9  +
    /* CborSerializerGenerator.kt:233 */
    8     10   
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
          11  +
    /* CborSerializerGenerator.kt:235 */
    9     12   
    {
          13  +
        /* CborSerializerGenerator.kt:236 */
   10     14   
        let encoder = &mut encoder;
          15  +
        /* CborSerializerGenerator.kt:403 */
   11     16   
        crate::protocol_serde::shape_single_member_struct_operation_output::ser_single_member_struct_operation_output_output(encoder, value )?;
          17  +
        /* CborSerializerGenerator.kt:235 */
   12     18   
    }
          19  +
    /* CborSerializerGenerator.kt:242 */
   13     20   
    ::std::result::Result::Ok(encoder.into_writer())
          21  +
    /* CborSerializerGenerator.kt:228 */
   14     22   
}
   15     23   
          24  +
/* CborSerializerGenerator.kt:369 */
   16     25   
pub fn ser_single_member_struct_operation_output_output(
   17     26   
    encoder: &mut ::aws_smithy_cbor::Encoder,
   18     27   
    #[allow(unused)] input: &crate::output::SingleMemberStructOperationOutput,
   19     28   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          29  +
    /* CborSerializerGenerator.kt:377 */
   20     30   
    encoder.begin_map();
          31  +
    /* CborSerializerGenerator.kt:414 */
   21     32   
    if let Some(var_1) = &input.message {
          33  +
        /* CborSerializerGenerator.kt:462 */
   22     34   
        encoder.str("message").str(var_1.as_str());
          35  +
        /* CborSerializerGenerator.kt:414 */
   23     36   
    }
          37  +
    /* CborSerializerGenerator.kt:393 */
   24     38   
    encoder.end();
          39  +
    /* CborSerializerGenerator.kt:394 */
   25     40   
    Ok(())
          41  +
    /* CborSerializerGenerator.kt:369 */
   26     42   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras/rust-server-codegen/src/protocol_serde/shape_struct_list.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:616 */
    2      3   
pub(crate) fn de_struct_list(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    crate::unconstrained::struct_list_unconstrained::StructListUnconstrained,
    6      7   
    ::aws_smithy_cbor::decode::DeserializeError,
    7      8   
> {
    8      9   
    fn member(
    9     10   
        mut list: crate::unconstrained::struct_list_unconstrained::StructListUnconstrained,
   10     11   
        decoder: &mut ::aws_smithy_cbor::Decoder,
   11     12   
    ) -> ::std::result::Result<