From 8fde5f40ba98c9cca29df923efcf88281874f2ab Mon Sep 17 00:00:00 2001 From: Alex Chew Date: Mon, 2 Sep 2024 12:00:06 -0700 Subject: [PATCH 1/4] feat: Rust codegen for more SimpleTypes models (#542) --- .../rust/src/standard_library_externs.rs | 80 + .../rust/src/standard_library_externs.rs | 80 + .../rust/src/implementation_from_dafny.rs-e | 1745 --------------- .../rust/src/standard_library_externs.rs | 80 + .../rust/src/standard_library_externs.rs | 80 + .../rust/src/standard_library_externs.rs | 80 + .../rust/src/standard_library_externs.rs | 80 + TestModels/SimpleTypes/SimpleBlob/Makefile | 3 +- .../SimpleBlob/runtimes/rust/Cargo.toml | 8 +- .../SimpleBlob/runtimes/rust/src/client.rs | 16 +- .../runtimes/rust/src/client/get_blob.rs | 8 +- .../rust/src/client/get_blob_known_value.rs | 17 - .../src/client/get_blob_known_value_test.rs | 15 + .../runtimes/rust/src/conversions.rs | 12 +- .../runtimes/rust/src/conversions/error.rs | 32 + .../runtimes/rust/src/conversions/get_blob.rs | 16 +- .../conversions/get_blob/_get_blob_input.rs | 44 +- .../conversions/get_blob/_get_blob_output.rs | 45 +- .../src/conversions/get_blob_known_value.rs | 39 - .../_get_blob_known_value_input.rs | 41 - .../_get_blob_known_value_output.rs | 43 - .../conversions/get_blob_known_value_test.rs | 33 + .../_get_blob_known_value_test_input.rs | 24 + .../_get_blob_known_value_test_output.rs | 24 + .../src/conversions/simple_blob_config.rs | 5 +- .../simple_blob_config/_simple_blob_config.rs | 9 +- .../SimpleBlob/runtimes/rust/src/error.rs | 4 +- .../rust/src/error/sealed_unhandled.rs | 10 +- .../SimpleBlob/runtimes/rust/src/lib.rs | 19 - .../SimpleBlob/runtimes/rust/src/operation.rs | 9 +- .../runtimes/rust/src/operation/get_blob.rs | 19 +- .../src/operation/get_blob/_get_blob_input.rs | 50 +- .../operation/get_blob/_get_blob_output.rs | 56 +- .../rust/src/operation/get_blob/builders.rs | 38 +- .../_get_blob_known_value_input.rs | 63 - .../_get_blob_known_value_output.rs | 63 - .../get_blob_known_value/builders.rs | 80 - ..._value.rs => get_blob_known_value_test.rs} | 58 +- .../_get_blob_input.rs | 58 + .../_get_blob_output.rs | 58 + .../get_blob_known_value_test/builders.rs | 74 + .../rust/src/standard_library_conversions.rs | 358 ++-- .../rust/src/standard_library_externs.rs | 80 + .../SimpleBlob/runtimes/rust/src/types.rs | 5 +- .../rust/src/types/simple_blob_config.rs | 5 +- .../SimpleBlob/runtimes/rust/src/wrapped.rs | 15 + .../runtimes/rust/src/wrapped/client.rs | 119 ++ .../runtimes/rust/tests/simple_blob_test.rs | 10 +- .../rust/src/standard_library_externs.rs | 80 + TestModels/SimpleTypes/SimpleDouble/Makefile | 3 +- .../SimpleDouble/runtimes/rust/Cargo.toml | 8 +- .../SimpleDouble/runtimes/rust/src/client.rs | 7 +- .../runtimes/rust/src/client/get_double.rs | 8 +- .../runtimes/rust/src/conversions.rs | 10 +- .../runtimes/rust/src/conversions/error.rs | 32 + .../rust/src/conversions/get_double.rs | 8 +- .../get_double/_get_double_input.rs | 45 +- .../get_double/_get_double_output.rs | 45 +- .../src/conversions/simple_double_config.rs | 5 +- .../_simple_double_config.rs | 6 +- .../SimpleDouble/runtimes/rust/src/error.rs | 4 +- .../rust/src/error/sealed_unhandled.rs | 10 +- .../SimpleDouble/runtimes/rust/src/lib.rs | 19 - .../runtimes/rust/src/operation.rs | 5 +- .../runtimes/rust/src/operation/get_double.rs | 8 +- .../operation/get_double/_get_double_input.rs | 40 +- .../get_double/_get_double_output.rs | 46 +- .../rust/src/operation/get_double/builders.rs | 32 +- .../rust/src/standard_library_conversions.rs | 358 ++-- .../rust/src/standard_library_externs.rs | 80 + .../SimpleDouble/runtimes/rust/src/types.rs | 5 +- .../rust/src/types/simple_double_config.rs | 5 +- .../SimpleDouble/runtimes/rust/src/wrapped.rs | 15 + .../runtimes/rust/src/wrapped/client.rs | 89 + TestModels/SimpleTypes/SimpleEnum/Makefile | 3 +- .../SimpleEnum/runtimes/rust/Cargo.toml | 8 +- .../SimpleEnum/runtimes/rust/src/client.rs | 9 +- .../runtimes/rust/src/client/get_enum.rs | 8 +- .../client/get_enum_first_known_value_test.rs | 23 +- .../get_enum_second_known_value_test.rs | 23 +- .../client/get_enum_third_known_value_test.rs | 23 +- .../runtimes/rust/src/conversions.rs | 21 +- .../runtimes/rust/src/conversions/error.rs | 32 + .../runtimes/rust/src/conversions/get_enum.rs | 5 +- .../conversions/get_enum/_get_enum_input.rs | 53 +- .../conversions/get_enum/_get_enum_output.rs | 53 +- .../get_enum_first_known_value_test.rs | 5 +- .../_get_enum_first_known_value_test_input.rs | 57 +- ..._get_enum_first_known_value_test_output.rs | 57 +- .../get_enum_second_known_value_test.rs | 5 +- ..._get_enum_second_known_value_test_input.rs | 57 +- ...get_enum_second_known_value_test_output.rs | 57 +- .../get_enum_third_known_value_test.rs | 5 +- .../_get_enum_third_known_value_test_input.rs | 57 +- ..._get_enum_third_known_value_test_output.rs | 57 +- .../src/conversions/simple_enum_config.rs | 5 +- .../simple_enum_config/_simple_enum_config.rs | 6 +- .../rust/src/conversions/simple_enum_shape.rs | 26 +- .../simple_enum_shape/_simple_enum_shape.rs | 23 - .../SimpleEnum/runtimes/rust/src/error.rs | 4 +- .../rust/src/error/sealed_unhandled.rs | 10 +- .../SimpleEnum/runtimes/rust/src/lib.rs | 19 - .../SimpleEnum/runtimes/rust/src/operation.rs | 11 +- .../runtimes/rust/src/operation/get_enum.rs | 19 +- .../src/operation/get_enum/_get_enum_input.rs | 55 +- .../operation/get_enum/_get_enum_output.rs | 59 +- .../rust/src/operation/get_enum/builders.rs | 40 +- .../get_enum_first_known_value_test.rs | 36 +- .../_get_enum_first_known_value_test_input.rs | 69 - ..._get_enum_first_known_value_test_output.rs | 69 - .../_get_enum_input.rs | 58 + .../_get_enum_output.rs | 58 + .../builders.rs | 62 +- .../get_enum_second_known_value_test.rs | 40 +- .../_get_enum_input.rs | 58 + .../_get_enum_output.rs | 58 + ..._get_enum_second_known_value_test_input.rs | 69 - ...get_enum_second_known_value_test_output.rs | 69 - .../builders.rs | 61 +- .../get_enum_third_known_value_test.rs | 36 +- .../_get_enum_input.rs | 58 + .../_get_enum_output.rs | 58 + .../_get_enum_third_known_value_test_input.rs | 68 - ..._get_enum_third_known_value_test_output.rs | 69 - .../builders.rs | 62 +- .../rust/src/standard_library_conversions.rs | 358 ++-- .../rust/src/standard_library_externs.rs | 80 + .../SimpleEnum/runtimes/rust/src/types.rs | 11 +- .../rust/src/types/_simple_enum_shape.rs | 19 + .../rust/src/types/simple_enum_config.rs | 5 +- .../rust/src/types/simple_enum_shape.rs | 6 - .../SimpleEnum/runtimes/rust/src/wrapped.rs | 15 + .../runtimes/rust/src/wrapped/client.rs | 179 ++ .../runtimes/rust/tests/simple_enum_test.rs | 18 +- TestModels/SimpleTypes/SimpleEnumV2/Makefile | 3 +- .../SimpleEnumV2/runtimes/rust/Cargo.toml | 8 +- .../SimpleEnumV2/runtimes/rust/src/client.rs | 9 +- .../runtimes/rust/src/client/get_enum_v2.rs | 8 +- .../get_enum_v2_first_known_value_test.rs | 23 +- .../get_enum_v2_second_known_value_test.rs | 23 +- .../get_enum_v2_third_known_value_test.rs | 23 +- .../runtimes/rust/src/conversions.rs | 21 +- .../runtimes/rust/src/conversions/error.rs | 32 + .../rust/src/conversions/get_enum_v2.rs | 16 +- .../get_enum_v2/_get_enum_v2_input.rs | 53 +- .../get_enum_v2/_get_enum_v2_output.rs | 53 +- .../get_enum_v2_first_known_value_test.rs | 5 +- ...et_enum_v2_first_known_value_test_input.rs | 59 +- ...t_enum_v2_first_known_value_test_output.rs | 59 +- .../get_enum_v2_second_known_value_test.rs | 5 +- ...t_enum_v2_second_known_value_test_input.rs | 59 +- ..._enum_v2_second_known_value_test_output.rs | 59 +- .../get_enum_v2_third_known_value_test.rs | 5 +- ...et_enum_v2_third_known_value_test_input.rs | 59 +- ...t_enum_v2_third_known_value_test_output.rs | 59 +- .../src/conversions/simple_enum_v2_config.rs | 5 +- .../_simple_enum_v2_config.rs | 6 +- .../src/conversions/simple_enum_v2_shape.rs | 26 +- .../_simple_enum_v2_shape.rs | 23 - .../SimpleEnumV2/runtimes/rust/src/error.rs | 4 +- .../rust/src/error/sealed_unhandled.rs | 10 +- .../SimpleEnumV2/runtimes/rust/src/lib.rs | 19 - .../runtimes/rust/src/operation.rs | 11 +- .../rust/src/operation/get_enum_v2.rs | 8 +- .../get_enum_v2/_get_enum_v2_input.rs | 51 +- .../get_enum_v2/_get_enum_v2_output.rs | 57 +- .../src/operation/get_enum_v2/builders.rs | 40 +- .../get_enum_v2_first_known_value_test.rs | 39 +- ...et_enum_v2_first_known_value_test_input.rs | 71 - ...t_enum_v2_first_known_value_test_output.rs | 71 - .../_get_enum_v2_input.rs | 58 + .../_get_enum_v2_output.rs | 58 + .../builders.rs | 62 +- .../get_enum_v2_second_known_value_test.rs | 39 +- .../_get_enum_v2_input.rs | 58 + .../_get_enum_v2_output.rs | 58 + ...t_enum_v2_second_known_value_test_input.rs | 71 - ..._enum_v2_second_known_value_test_output.rs | 71 - .../builders.rs | 61 +- .../get_enum_v2_third_known_value_test.rs | 39 +- .../_get_enum_v2_input.rs | 58 + .../_get_enum_v2_output.rs | 58 + ...et_enum_v2_third_known_value_test_input.rs | 70 - ...t_enum_v2_third_known_value_test_output.rs | 71 - .../builders.rs | 62 +- .../rust/src/standard_library_conversions.rs | 358 ++-- .../rust/src/standard_library_externs.rs | 80 + .../SimpleEnumV2/runtimes/rust/src/types.rs | 11 +- .../rust/src/types/_simple_enum_v2_shape.rs | 19 + .../rust/src/types/simple_enum_v2_config.rs | 5 +- .../rust/src/types/simple_enum_v2_shape.rs | 6 - .../SimpleEnumV2/runtimes/rust/src/wrapped.rs | 15 + .../runtimes/rust/src/wrapped/client.rs | 179 ++ .../rust/tests/simple_enum_v2_test.rs | 18 +- TestModels/SimpleTypes/SimpleInteger/Makefile | 3 +- .../SimpleInteger/runtimes/rust/Cargo.toml | 8 +- .../SimpleInteger/runtimes/rust/src/client.rs | 9 +- .../runtimes/rust/src/client/get_integer.rs | 8 +- .../src/client/get_integer_known_value.rs | 18 - .../client/get_integer_known_value_test.rs | 15 + .../runtimes/rust/src/conversions.rs | 12 +- .../runtimes/rust/src/conversions/error.rs | 32 + .../rust/src/conversions/get_integer.rs | 5 +- .../get_integer/_get_integer_input.rs | 35 +- .../get_integer/_get_integer_output.rs | 35 +- .../conversions/get_integer_known_value.rs | 32 - .../_get_integer_known_value_input.rs | 37 - .../_get_integer_known_value_output.rs | 37 - .../get_integer_known_value_test.rs | 33 + .../_get_integer_known_value_test_input.rs | 24 + .../_get_integer_known_value_test_output.rs | 24 + .../src/conversions/simple_integer_config.rs | 5 +- .../_simple_integer_config.rs | 6 +- .../SimpleInteger/runtimes/rust/src/error.rs | 4 +- .../rust/src/error/sealed_unhandled.rs | 10 +- .../SimpleInteger/runtimes/rust/src/lib.rs | 19 - .../runtimes/rust/src/operation.rs | 9 +- .../rust/src/operation/get_integer.rs | 8 +- .../get_integer/_get_integer_input.rs | 40 +- .../get_integer/_get_integer_output.rs | 46 +- .../src/operation/get_integer/builders.rs | 34 +- .../_get_integer_known_value_input.rs | 59 - .../_get_integer_known_value_output.rs | 60 - .../get_integer_known_value/builders.rs | 78 - ...lue.rs => get_integer_known_value_test.rs} | 65 +- .../_get_integer_input.rs | 58 + .../_get_integer_output.rs | 58 + .../get_integer_known_value_test/builders.rs | 74 + .../rust/src/standard_library_conversions.rs | 358 ++-- .../rust/src/standard_library_externs.rs | 80 + .../SimpleInteger/runtimes/rust/src/types.rs | 5 +- .../rust/src/types/simple_integer_config.rs | 33 +- .../runtimes/rust/src/wrapped.rs | 15 + .../runtimes/rust/src/wrapped/client.rs | 119 ++ .../rust/tests/simple_integer_test.rs | 2 +- TestModels/SimpleTypes/SimpleLong/Makefile | 3 +- .../SimpleLong/runtimes/rust/Cargo.toml | 8 +- .../SimpleLong/runtimes/rust/src/client.rs | 9 +- .../runtimes/rust/src/client/get_long.rs | 8 +- .../rust/src/client/get_long_known_value.rs | 17 - .../src/client/get_long_known_value_test.rs | 15 + .../runtimes/rust/src/conversions.rs | 12 +- .../runtimes/rust/src/conversions/error.rs | 32 + .../runtimes/rust/src/conversions/get_long.rs | 5 +- .../conversions/get_long/_get_long_input.rs | 35 +- .../conversions/get_long/_get_long_output.rs | 35 +- .../src/conversions/get_long_known_value.rs | 32 - .../_get_long_known_value_input.rs | 37 - .../_get_long_known_value_output.rs | 37 - .../conversions/get_long_known_value_test.rs | 33 + .../_get_long_known_value_test_input.rs | 24 + .../_get_long_known_value_test_output.rs | 24 + .../src/conversions/simple_long_config.rs | 5 +- .../simple_long_config/_simple_long_config.rs | 6 +- .../SimpleLong/runtimes/rust/src/error.rs | 4 +- .../rust/src/error/sealed_unhandled.rs | 10 +- .../SimpleLong/runtimes/rust/src/lib.rs | 19 - .../SimpleLong/runtimes/rust/src/operation.rs | 9 +- .../runtimes/rust/src/operation/get_long.rs | 19 +- .../src/operation/get_long/_get_long_input.rs | 44 +- .../operation/get_long/_get_long_output.rs | 50 +- .../rust/src/operation/get_long/builders.rs | 32 +- .../_get_long_known_value_input.rs | 57 - .../_get_long_known_value_output.rs | 57 - .../get_long_known_value/builders.rs | 74 - ..._value.rs => get_long_known_value_test.rs} | 58 +- .../_get_long_input.rs | 58 + .../_get_long_output.rs | 58 + .../get_long_known_value_test/builders.rs | 74 + .../rust/src/standard_library_conversions.rs | 358 ++-- .../rust/src/standard_library_externs.rs | 80 + .../SimpleLong/runtimes/rust/src/types.rs | 5 +- .../rust/src/types/simple_long_config.rs | 5 +- .../SimpleLong/runtimes/rust/src/wrapped.rs | 15 + .../runtimes/rust/src/wrapped/client.rs | 119 ++ .../runtimes/rust/tests/simple_long_test.rs | 2 +- TestModels/SimpleTypes/SimpleString/Makefile | 3 +- .../SimpleString/runtimes/rust/Cargo.toml | 10 +- .../SimpleString/runtimes/rust/src/client.rs | 11 +- .../runtimes/rust/src/client/get_string.rs | 8 +- .../rust/src/client/get_string_known_value.rs | 18 +- .../rust/src/client/get_string_utf8.rs | 12 +- .../src/client/get_string_utf8_known_value.rs | 14 +- .../runtimes/rust/src/conversions.rs | 16 +- .../runtimes/rust/src/conversions/error.rs | 32 + .../rust/src/conversions/get_string.rs | 8 +- .../get_string/_get_string_input.rs | 41 +- .../get_string/_get_string_output.rs | 45 +- .../src/conversions/get_string_known_value.rs | 8 +- .../_get_string_known_value_input.rs | 45 +- .../_get_string_known_value_output.rs | 49 +- .../rust/src/conversions/get_string_utf8.rs | 8 +- .../get_string_utf8/_get_string_utf8_input.rs | 47 +- .../_get_string_utf8_output.rs | 53 +- .../get_string_utf8_known_value.rs | 8 +- .../_get_string_utf8_known_value_input.rs | 51 +- .../_get_string_utf8_known_value_output.rs | 57 +- .../src/conversions/simple_string_config.rs | 5 +- .../_simple_string_config.rs | 6 +- .../SimpleString/runtimes/rust/src/error.rs | 4 +- .../rust/src/error/sealed_unhandled.rs | 10 +- .../rust/src/implementation_from_dafny.rs-e | 1880 ----------------- .../SimpleString/runtimes/rust/src/lib.rs | 17 - .../runtimes/rust/src/operation.rs | 6 +- .../runtimes/rust/src/operation/get_string.rs | 8 +- .../operation/get_string/_get_string_input.rs | 38 +- .../get_string/_get_string_output.rs | 38 +- .../rust/src/operation/get_string/builders.rs | 36 +- .../src/operation/get_string_known_value.rs | 35 +- .../_get_string_input.rs | 58 + .../_get_string_known_value_input.rs | 60 - .../_get_string_known_value_output.rs | 59 - .../_get_string_output.rs | 58 + .../get_string_known_value/builders.rs | 59 +- .../rust/src/operation/get_string_utf8.rs | 11 +- .../get_string_utf8/_get_string_utf8_input.rs | 38 +- .../_get_string_utf8_output.rs | 38 +- .../src/operation/get_string_utf8/builders.rs | 42 +- .../operation/get_string_utf8_known_value.rs | 19 +- .../_get_string_utf8_input.rs | 58 + .../_get_string_utf8_known_value_input.rs | 56 - .../_get_string_utf8_known_value_output.rs | 56 - .../_get_string_utf8_output.rs | 58 + .../get_string_utf8_known_value/builders.rs | 52 +- .../rust/src/standard_library_conversions.rs | 358 ++-- .../rust/src/standard_library_externs.rs | 80 + .../SimpleString/runtimes/rust/src/types.rs | 5 +- .../rust/src/types/simple_string_config.rs | 5 +- .../SimpleString/runtimes/rust/src/wrapped.rs | 15 + .../runtimes/rust/src/wrapped/client.rs | 179 ++ .../SimpleTypes/SimpleTimestamp/Makefile | 5 +- .../SimpleTimestamp/runtimes/rust/Cargo.toml | 11 +- .../runtimes/rust/src/client.rs | 7 +- .../runtimes/rust/src/client/get_timestamp.rs | 12 +- .../runtimes/rust/src/conversions.rs | 10 +- .../runtimes/rust/src/conversions/error.rs | 32 + .../rust/src/conversions/get_timestamp.rs | 8 +- .../get_timestamp/_get_timestamp_input.rs | 39 +- .../get_timestamp/_get_timestamp_output.rs | 39 +- .../conversions/simple_timestamp_config.rs | 5 +- .../_simple_timestamp_config.rs | 8 +- .../runtimes/rust/src/error.rs | 4 +- .../rust/src/error/sealed_unhandled.rs | 10 +- .../SimpleTimestamp/runtimes/rust/src/lib.rs | 19 - .../runtimes/rust/src/operation.rs | 5 +- .../rust/src/operation/get_timestamp.rs | 15 +- .../get_timestamp/_get_timestamp_input.rs | 44 +- .../get_timestamp/_get_timestamp_output.rs | 55 +- .../src/operation/get_timestamp/builders.rs | 32 +- .../rust/src/standard_library_conversions.rs | 358 ++-- .../rust/src/standard_library_externs.rs | 80 + .../runtimes/rust/src/types.rs | 5 +- .../rust/src/types/simple_timestamp_config.rs | 5 +- .../runtimes/rust/src/wrapped.rs | 15 + .../runtimes/rust/src/wrapped/client.rs | 89 + .../rust/tests/simple_timestamp_test.rs | 2 +- .../src/WrappedSimpleTypesTimestampImpl.dfy | 10 + .../test/SimpleTimestampImplTest.dfy | 22 +- .../test/WrappedSimpleTimestampTest.dfy | 1 + .../rust/src/standard_library_externs.rs | 80 + .../rust/src/conversions/attribute_action.rs | 12 +- .../batch_statement_error_code_enum.rs | 44 +- .../rust/src/conversions/billing_mode.rs | 8 +- .../src/conversions/comparison_operator.rs | 52 +- .../src/conversions/conditional_operator.rs | 8 +- .../rust/src/conversions/index_status.rs | 16 +- .../runtimes/rust/src/conversions/key_type.rs | 8 +- .../rust/src/conversions/projection_type.rs | 12 +- .../rust/src/conversions/replica_status.rs | 28 +- .../conversions/return_consumed_capacity.rs | 12 +- .../return_item_collection_metrics.rs | 8 +- .../rust/src/conversions/return_value.rs | 20 +- ...eturn_values_on_condition_check_failure.rs | 8 +- .../src/conversions/scalar_attribute_type.rs | 12 +- .../runtimes/rust/src/conversions/select.rs | 16 +- .../rust/src/conversions/sse_status.rs | 20 +- .../runtimes/rust/src/conversions/sse_type.rs | 8 +- .../rust/src/conversions/stream_view_type.rs | 16 +- .../rust/src/conversions/table_class.rs | 8 +- .../rust/src/conversions/table_status.rs | 28 +- .../rust/src/standard_library_externs.rs | 80 + .../conversions/customer_master_key_spec.rs | 52 +- .../rust/src/conversions/data_key_spec.rs | 8 +- .../conversions/encryption_algorithm_spec.rs | 12 +- .../key_agreement_algorithm_spec.rs | 4 +- .../conversions/key_encryption_mechanism.rs | 4 +- .../runtimes/rust/src/conversions/key_spec.rs | 52 +- .../rust/src/conversions/key_usage_type.rs | 16 +- .../rust/src/conversions/origin_type.rs | 16 +- .../src/conversions/signing_algorithm_spec.rs | 40 +- .../rust/src/standard_library_externs.rs | 80 + .../amazon/polymorph/CodegenEngine.java | 109 +- .../smithydotnet/TypeConversionCodegen.java | 17 +- .../generator/AbstractRustShimGenerator.java | 402 ++-- .../generator/RustAwsSdkShimGenerator.java | 86 +- .../generator/RustLibraryShimGenerator.java | 163 +- .../amazon/polymorph/utils/ModelUtils.java | 30 + .../runtimes/rust/conversions/operation.rs | 4 +- .../runtimes/rust/operation/outer.rs | 4 +- .../rust/src/standard_library_externs.rs | 80 + .../templates/runtimes/rust/types.rs | 4 +- .../templates/runtimes/rust/types/enum.rs | 12 + .../wrapped/client_operation_impl.part.rs | 4 +- 403 files changed, 9498 insertions(+), 10533 deletions(-) create mode 100644 TestModels/Aggregate/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/Constructor/runtimes/rust/src/standard_library_externs.rs delete mode 100644 TestModels/Errors/runtimes/rust/src/implementation_from_dafny.rs-e create mode 100644 TestModels/Errors/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/LanguageSpecificLogic/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/Refinement/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/Resource/runtimes/rust/src/standard_library_externs.rs delete mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob_known_value.rs create mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob_known_value_test.rs create mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/error.rs delete mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value.rs delete mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_output.rs create mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value_test.rs create mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value_test/_get_blob_known_value_test_input.rs create mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value_test/_get_blob_known_value_test_output.rs delete mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/lib.rs delete mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_output.rs delete mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/builders.rs rename TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/{get_blob_known_value.rs => get_blob_known_value_test.rs} (67%) create mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test/_get_blob_input.rs create mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test/_get_blob_output.rs create mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test/builders.rs create mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/wrapped.rs create mode 100644 TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/wrapped/client.rs create mode 100644 TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/error.rs delete mode 100644 TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/lib.rs create mode 100644 TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/wrapped.rs create mode 100644 TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/wrapped/client.rs create mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/error.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape/_simple_enum_shape.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/lib.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs create mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_input.rs create mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_output.rs create mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_input.rs create mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_output.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs create mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_input.rs create mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_output.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs create mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/_simple_enum_shape.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_shape.rs create mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/wrapped.rs create mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/wrapped/client.rs create mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/error.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape/_simple_enum_v2_shape.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/lib.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs create mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_input.rs create mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_output.rs create mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_input.rs create mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_output.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs create mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_input.rs create mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_output.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs create mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/_simple_enum_v2_shape.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_shape.rs create mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/wrapped.rs create mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/wrapped/client.rs delete mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer_known_value.rs create mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer_known_value_test.rs create mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/error.rs delete mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value.rs delete mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_output.rs create mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value_test.rs create mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value_test/_get_integer_known_value_test_input.rs create mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value_test/_get_integer_known_value_test_output.rs delete mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/lib.rs delete mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_output.rs delete mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/builders.rs rename TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/{get_integer_known_value.rs => get_integer_known_value_test.rs} (67%) create mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test/_get_integer_input.rs create mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test/_get_integer_output.rs create mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test/builders.rs create mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/wrapped.rs create mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/wrapped/client.rs delete mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long_known_value.rs create mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long_known_value_test.rs create mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/error.rs delete mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value.rs delete mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_output.rs create mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value_test.rs create mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value_test/_get_long_known_value_test_input.rs create mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value_test/_get_long_known_value_test_output.rs delete mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/lib.rs delete mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_output.rs delete mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/builders.rs rename TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/{get_long_known_value.rs => get_long_known_value_test.rs} (67%) create mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test/_get_long_input.rs create mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test/_get_long_output.rs create mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test/builders.rs create mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/wrapped.rs create mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/wrapped/client.rs create mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/error.rs delete mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/implementation_from_dafny.rs-e delete mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/lib.rs create mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_output.rs create mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_output.rs create mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_known_value_input.rs delete mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_known_value_output.rs create mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_output.rs create mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/wrapped.rs create mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/wrapped/client.rs create mode 100644 TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/error.rs delete mode 100644 TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/lib.rs create mode 100644 TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/wrapped.rs create mode 100644 TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/wrapped/client.rs create mode 100644 TestModels/SimpleTypes/SimpleTimestamp/src/WrappedSimpleTypesTimestampImpl.dfy create mode 100644 TestModels/Union/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/aws-sdks/ddb-lite/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/aws-sdks/kms-lite/runtimes/rust/src/standard_library_externs.rs create mode 100644 codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/src/standard_library_externs.rs create mode 100644 codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/enum.rs diff --git a/TestModels/Aggregate/runtimes/rust/src/standard_library_externs.rs b/TestModels/Aggregate/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/Aggregate/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/Constructor/runtimes/rust/src/standard_library_externs.rs b/TestModels/Constructor/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/Constructor/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/Errors/runtimes/rust/src/implementation_from_dafny.rs-e b/TestModels/Errors/runtimes/rust/src/implementation_from_dafny.rs-e deleted file mode 100644 index 742c6a6ba..000000000 --- a/TestModels/Errors/runtimes/rust/src/implementation_from_dafny.rs-e +++ /dev/null @@ -1,1745 +0,0 @@ -#![allow(warnings, unconditional_panic)] -#![allow(nonstandard_style)] - -pub mod _module { - -} -pub mod simple { - pub mod errors { - pub mod internaldafny { - pub use ::dafny_runtime::UpcastObject; - pub use ::std::any::Any; - pub use crate::simple::errors::internaldafny::types::ISimpleErrorsClient; - - pub struct _default {} - - impl _default { - pub fn DefaultSimpleErrorsConfig() -> ::std::rc::Rc { - ::std::rc::Rc::new(crate::simple::errors::internaldafny::types::SimpleErrorsConfig::SimpleErrorsConfig {}) - } - pub fn SimpleErrors(config: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut res = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - let mut client = ::dafny_runtime::MaybePlacebo::<::dafny_runtime::Object>::new(); - let mut _nw0: ::dafny_runtime::Object = crate::simple::errors::internaldafny::SimpleErrorsClient::_allocate_object(); - crate::simple::errors::internaldafny::SimpleErrorsClient::_ctor(&_nw0, &::std::rc::Rc::new(crate::r#_SimpleErrorsImpl_Compile::Config::Config {})); - client = ::dafny_runtime::MaybePlacebo::from(_nw0.clone()); - res = ::dafny_runtime::MaybePlacebo::from(::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::dafny_runtime::Object, ::std::rc::Rc>::Success { - value: client.read() - })); - return res.read(); - } - pub fn CreateSuccessOfClient(client: &::dafny_runtime::Object) -> ::std::rc::Rc, ::std::rc::Rc>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::dafny_runtime::Object, ::std::rc::Rc>::Success { - value: client.clone() - }) - } - pub fn CreateFailureOfError(error: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::dafny_runtime::Object, ::std::rc::Rc>::Failure { - error: error.clone() - }) - } - } - - pub struct SimpleErrorsClient { - pub r#__i_config: ::std::rc::Rc - } - - impl SimpleErrorsClient { - pub fn _allocate_object() -> ::dafny_runtime::Object { - ::dafny_runtime::allocate_object::() - } - pub fn _ctor(this: &::dafny_runtime::Object, config: &::std::rc::Rc) -> () { - let mut _set__i_config: bool = false; - ::dafny_runtime::update_field_uninit_object!(this.clone(), r#__i_config, _set__i_config, config.clone()); - return (); - } - pub fn config(&self) -> ::std::rc::Rc { - self.r#__i_config.clone() - } - } - - impl UpcastObject - for crate::simple::errors::internaldafny::SimpleErrorsClient { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); - } - - impl ISimpleErrorsClient - for crate::simple::errors::internaldafny::SimpleErrorsClient { - fn AlwaysError(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - let mut _out0 = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - _out0 = ::dafny_runtime::MaybePlacebo::from(crate::r#_SimpleErrorsImpl_Compile::_default::AlwaysError(&self.config().clone(), input)); - output = ::dafny_runtime::MaybePlacebo::from(_out0.read()); - return output.read(); - } - fn AlwaysMultipleErrors(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - let mut _out1 = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - _out1 = ::dafny_runtime::MaybePlacebo::from(crate::r#_SimpleErrorsImpl_Compile::_default::AlwaysMultipleErrors(&self.config().clone(), input)); - output = ::dafny_runtime::MaybePlacebo::from(_out1.read()); - return output.read(); - } - fn AlwaysNativeError(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - let mut _out2 = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - _out2 = ::dafny_runtime::MaybePlacebo::from(crate::r#_SimpleErrorsImpl_Compile::_default::AlwaysNativeError(&self.config().clone(), input)); - output = ::dafny_runtime::MaybePlacebo::from(_out2.read()); - return output.read(); - } - } - - impl UpcastObject - for crate::simple::errors::internaldafny::SimpleErrorsClient { - ::dafny_runtime::UpcastObjectFn!(dyn crate::simple::errors::internaldafny::types::ISimpleErrorsClient); - } - - pub mod types { - pub use ::std::fmt::Debug; - pub use ::dafny_runtime::DafnyPrint; - pub use ::std::cmp::Eq; - pub use ::std::hash::Hash; - pub use ::std::default::Default; - pub use ::std::convert::AsRef; - pub use ::dafny_runtime::UpcastObject; - pub use ::std::any::Any; - - #[derive(PartialEq, Clone)] - pub enum DafnyCallEvent { - DafnyCallEvent { - input: I, - output: O - } - } - - impl DafnyCallEvent { - pub fn input(&self) -> &I { - match self { - DafnyCallEvent::DafnyCallEvent{input, output, } => input, - } - } - pub fn output(&self) -> &O { - match self { - DafnyCallEvent::DafnyCallEvent{input, output, } => output, - } - } - } - - impl Debug - for DafnyCallEvent { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for DafnyCallEvent { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - DafnyCallEvent::DafnyCallEvent{input, output, } => { - write!(_formatter, "simple.errors.internaldafny.types.DafnyCallEvent.DafnyCallEvent(")?; - ::dafny_runtime::DafnyPrint::fmt_print(input, _formatter, false)?; - write!(_formatter, ", ")?; - ::dafny_runtime::DafnyPrint::fmt_print(output, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Eq - for DafnyCallEvent {} - - impl Hash - for DafnyCallEvent { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - DafnyCallEvent::DafnyCallEvent{input, output, } => { - ::std::hash::Hash::hash(input, _state); - ::std::hash::Hash::hash(output, _state) - }, - } - } - } - - impl Default - for DafnyCallEvent { - fn default() -> DafnyCallEvent { - DafnyCallEvent::DafnyCallEvent { - input: ::std::default::Default::default(), - output: ::std::default::Default::default() - } - } - } - - impl AsRef> - for &DafnyCallEvent { - fn as_ref(&self) -> Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum GetErrorsInput { - GetErrorsInput { - value: ::std::rc::Rc>> - } - } - - impl GetErrorsInput { - pub fn value(&self) -> &::std::rc::Rc>> { - match self { - GetErrorsInput::GetErrorsInput{value, } => value, - } - } - } - - impl Debug - for GetErrorsInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for GetErrorsInput { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - GetErrorsInput::GetErrorsInput{value, } => { - write!(_formatter, "simple.errors.internaldafny.types.GetErrorsInput.GetErrorsInput(")?; - ::dafny_runtime::DafnyPrint::fmt_print(value, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Eq - for GetErrorsInput {} - - impl Hash - for GetErrorsInput { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - GetErrorsInput::GetErrorsInput{value, } => { - ::std::hash::Hash::hash(value, _state) - }, - } - } - } - - impl Default - for GetErrorsInput { - fn default() -> GetErrorsInput { - GetErrorsInput::GetErrorsInput { - value: ::std::default::Default::default() - } - } - } - - impl AsRef - for &GetErrorsInput { - fn as_ref(&self) -> Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum GetErrorsOutput { - GetErrorsOutput { - value: ::std::rc::Rc>> - } - } - - impl GetErrorsOutput { - pub fn value(&self) -> &::std::rc::Rc>> { - match self { - GetErrorsOutput::GetErrorsOutput{value, } => value, - } - } - } - - impl Debug - for GetErrorsOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for GetErrorsOutput { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - GetErrorsOutput::GetErrorsOutput{value, } => { - write!(_formatter, "simple.errors.internaldafny.types.GetErrorsOutput.GetErrorsOutput(")?; - ::dafny_runtime::DafnyPrint::fmt_print(value, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Eq - for GetErrorsOutput {} - - impl Hash - for GetErrorsOutput { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - GetErrorsOutput::GetErrorsOutput{value, } => { - ::std::hash::Hash::hash(value, _state) - }, - } - } - } - - impl Default - for GetErrorsOutput { - fn default() -> GetErrorsOutput { - GetErrorsOutput::GetErrorsOutput { - value: ::std::default::Default::default() - } - } - } - - impl AsRef - for &GetErrorsOutput { - fn as_ref(&self) -> Self { - self - } - } - - pub struct ISimpleErrorsClientCallHistory {} - - impl ISimpleErrorsClientCallHistory { - pub fn _allocate_object() -> ::dafny_runtime::Object { - ::dafny_runtime::allocate_object::() - } - } - - impl UpcastObject - for crate::simple::errors::internaldafny::types::ISimpleErrorsClientCallHistory { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); - } - - pub trait ISimpleErrorsClient: ::std::any::Any + ::dafny_runtime::UpcastObject { - fn AlwaysError(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>>; - fn AlwaysMultipleErrors(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>>; - fn AlwaysNativeError(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>>; - } - - #[derive(PartialEq, Clone)] - pub enum SimpleErrorsConfig { - SimpleErrorsConfig {} - } - - impl SimpleErrorsConfig {} - - impl Debug - for SimpleErrorsConfig { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for SimpleErrorsConfig { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - SimpleErrorsConfig::SimpleErrorsConfig{} => { - write!(_formatter, "simple.errors.internaldafny.types.SimpleErrorsConfig.SimpleErrorsConfig")?; - Ok(()) - }, - } - } - } - - impl SimpleErrorsConfig { - pub fn _AllSingletonConstructors() -> ::dafny_runtime::SequenceIter<::std::rc::Rc> { - ::dafny_runtime::seq![::std::rc::Rc::new(SimpleErrorsConfig::SimpleErrorsConfig {})].iter() - } - } - - impl Eq - for SimpleErrorsConfig {} - - impl Hash - for SimpleErrorsConfig { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - SimpleErrorsConfig::SimpleErrorsConfig{} => { - - }, - } - } - } - - impl Default - for SimpleErrorsConfig { - fn default() -> SimpleErrorsConfig { - SimpleErrorsConfig::SimpleErrorsConfig {} - } - } - - impl AsRef - for &SimpleErrorsConfig { - fn as_ref(&self) -> Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Error { - SimpleErrorsException { - message: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> - }, - CollectionOfErrors { - list: ::dafny_runtime::Sequence<::std::rc::Rc>, - message: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> - }, - Opaque { - obj: ::dafny_runtime::Object - } - } - - impl Error { - pub fn message(&self) -> &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - match self { - Error::SimpleErrorsException{message, } => message, - Error::CollectionOfErrors{list, message, } => message, - Error::Opaque{obj, } => panic!("field does not exist on this variant"), - } - } - pub fn list(&self) -> &::dafny_runtime::Sequence<::std::rc::Rc> { - match self { - Error::SimpleErrorsException{message, } => panic!("field does not exist on this variant"), - Error::CollectionOfErrors{list, message, } => list, - Error::Opaque{obj, } => panic!("field does not exist on this variant"), - } - } - pub fn obj(&self) -> &::dafny_runtime::Object { - match self { - Error::SimpleErrorsException{message, } => panic!("field does not exist on this variant"), - Error::CollectionOfErrors{list, message, } => panic!("field does not exist on this variant"), - Error::Opaque{obj, } => obj, - } - } - } - - impl Debug - for Error { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Error { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Error::SimpleErrorsException{message, } => { - write!(_formatter, "simple.errors.internaldafny.types.Error.SimpleErrorsException(")?; - ::dafny_runtime::DafnyPrint::fmt_print(message, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - Error::CollectionOfErrors{list, message, } => { - write!(_formatter, "simple.errors.internaldafny.types.Error.CollectionOfErrors(")?; - ::dafny_runtime::DafnyPrint::fmt_print(list, _formatter, false)?; - write!(_formatter, ", ")?; - ::dafny_runtime::DafnyPrint::fmt_print(message, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - Error::Opaque{obj, } => { - write!(_formatter, "simple.errors.internaldafny.types.Error.Opaque(")?; - ::dafny_runtime::DafnyPrint::fmt_print(obj, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Eq - for Error {} - - impl Hash - for Error { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - Error::SimpleErrorsException{message, } => { - ::std::hash::Hash::hash(message, _state) - }, - Error::CollectionOfErrors{list, message, } => { - ::std::hash::Hash::hash(list, _state); - ::std::hash::Hash::hash(message, _state) - }, - Error::Opaque{obj, } => { - ::std::hash::Hash::hash(obj, _state) - }, - } - } - } - - impl Default - for Error { - fn default() -> Error { - Error::SimpleErrorsException { - message: ::std::default::Default::default() - } - } - } - - impl AsRef - for &Error { - fn as_ref(&self) -> Self { - self - } - } - - pub type OpaqueError = ::std::rc::Rc; - } - } - } -} -pub mod r#_SimpleErrorsImpl_Compile { - pub use ::std::fmt::Debug; - pub use ::dafny_runtime::DafnyPrint; - pub use ::std::cmp::Eq; - pub use ::std::hash::Hash; - pub use ::std::default::Default; - pub use ::std::convert::AsRef; - pub use ::dafny_runtime::UpcastObject; - pub use ::std::any::Any; - - pub struct _default {} - - impl _default { - pub fn AlwaysError(config: &::std::rc::Rc, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - if !matches!(input.value().as_ref(), crate::r#_Wrappers_Compile::Option::Some{ .. }) { - panic!("Halt") - }; - let mut res: ::std::rc::Rc = ::std::rc::Rc::new(crate::simple::errors::internaldafny::types::Error::SimpleErrorsException { - message: input.value().value().clone() - }); - output = ::dafny_runtime::MaybePlacebo::from(::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::std::rc::Rc, ::std::rc::Rc>::Failure { - error: res.clone() - })); - return output.read(); - } - pub fn AlwaysMultipleErrors(config: &::std::rc::Rc, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - if !matches!(input.value().as_ref(), crate::r#_Wrappers_Compile::Option::Some{ .. }) { - panic!("Halt") - }; - let mut res: ::std::rc::Rc = ::std::rc::Rc::new(crate::simple::errors::internaldafny::types::Error::CollectionOfErrors { - list: ::dafny_runtime::seq![::std::rc::Rc::new(crate::simple::errors::internaldafny::types::Error::SimpleErrorsException { - message: input.value().value().clone() - })], - message: ::dafny_runtime::string_utf16_of("Something") - }); - output = ::dafny_runtime::MaybePlacebo::from(::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::std::rc::Rc, ::std::rc::Rc>::Failure { - error: res.clone() - })); - return output.read(); - } - pub fn AlwaysNativeError(config: &::std::rc::Rc, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - let mut opaqueObject = ::dafny_runtime::MaybePlacebo::<::dafny_runtime::Object>::new(); - let mut _nw1: ::dafny_runtime::Object = crate::r#_SimpleErrorsImpl_Compile::SomeOpaqueGeneratedTypeForTesting::_allocate_object(); - crate::r#_SimpleErrorsImpl_Compile::SomeOpaqueGeneratedTypeForTesting::_ctor(&_nw1); - opaqueObject = ::dafny_runtime::MaybePlacebo::from(_nw1.clone()); - let mut res: ::std::rc::Rc = ::std::rc::Rc::new(crate::simple::errors::internaldafny::types::Error::Opaque { - obj: ::dafny_runtime::upcast_object::()(opaqueObject.read()) - }); - output = ::dafny_runtime::MaybePlacebo::from(::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::std::rc::Rc, ::std::rc::Rc>::Failure { - error: res.clone() - })); - return output.read(); - } - } - - #[derive(PartialEq, Clone)] - pub enum Config { - Config {} - } - - impl Config {} - - impl Debug - for Config { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Config { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Config::Config{} => { - write!(_formatter, "SimpleErrorsImpl_Compile.Config.Config")?; - Ok(()) - }, - } - } - } - - impl Config { - pub fn _AllSingletonConstructors() -> ::dafny_runtime::SequenceIter<::std::rc::Rc> { - ::dafny_runtime::seq![::std::rc::Rc::new(Config::Config {})].iter() - } - } - - impl Eq - for Config {} - - impl Hash - for Config { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - Config::Config{} => { - - }, - } - } - } - - impl Default - for Config { - fn default() -> Config { - Config::Config {} - } - } - - impl AsRef - for &Config { - fn as_ref(&self) -> Self { - self - } - } - - pub struct SomeOpaqueGeneratedTypeForTesting {} - - impl SomeOpaqueGeneratedTypeForTesting { - pub fn _allocate_object() -> ::dafny_runtime::Object { - ::dafny_runtime::allocate_object::() - } - pub fn _ctor(this: &::dafny_runtime::Object) -> () { - return (); - } - } - - impl UpcastObject - for SomeOpaqueGeneratedTypeForTesting { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); - } -} -pub mod r#_StandardLibrary_Compile { - pub struct _default {} - - impl _default { - pub fn Join<_T: ::dafny_runtime::DafnyType>(ss: &::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>>, joiner: &::dafny_runtime::Sequence<_T>) -> ::dafny_runtime::Sequence<_T> { - let mut _accumulator: ::dafny_runtime::Sequence<_T> = ::dafny_runtime::seq![] as ::dafny_runtime::Sequence<_T>; - let mut _r0 = ss.clone(); - let mut _r1 = joiner.clone(); - 'TAIL_CALL_START: loop { - let ss = _r0; - let joiner = _r1; - if ss.cardinality() == ::dafny_runtime::int!(1) { - return _accumulator.concat(&ss.get(&::dafny_runtime::int!(0))); - } else { - _accumulator = _accumulator.concat(&ss.get(&::dafny_runtime::int!(0)).concat(&joiner)); - let mut _in0: ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>> = ss.drop(&::dafny_runtime::int!(1)); - let mut _in1: ::dafny_runtime::Sequence<_T> = joiner.clone(); - _r0 = _in0.clone(); - _r1 = _in1.clone(); - continue 'TAIL_CALL_START; - } - } - } - pub fn Split<_T: ::dafny_runtime::DafnyTypeEq>(s: &::dafny_runtime::Sequence<_T>, delim: &_T) -> ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>> { - let mut _accumulator: ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>> = ::dafny_runtime::seq![] as ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>>; - let mut _r0 = s.clone(); - let mut _r1 = delim.clone(); - 'TAIL_CALL_START: loop { - let s = _r0; - let delim = _r1; - let mut i: ::std::rc::Rc> = crate::r#_StandardLibrary_Compile::_default::FindIndexMatching::<_T>(&s, &delim, &::dafny_runtime::int!(0)); - if matches!((&i).as_ref(), crate::r#_Wrappers_Compile::Option::Some{ .. }) { - _accumulator = _accumulator.concat(&::dafny_runtime::seq![s.take(i.value())]); - let mut _in2: ::dafny_runtime::Sequence<_T> = s.drop(&(i.value().clone() + ::dafny_runtime::int!(1))); - let mut _in3: _T = delim.clone(); - _r0 = _in2.clone(); - _r1 = _in3.clone(); - continue 'TAIL_CALL_START; - } else { - return _accumulator.concat(&::dafny_runtime::seq![s.clone()]); - } - } - } - pub fn SplitOnce<_T: ::dafny_runtime::DafnyTypeEq>(s: &::dafny_runtime::Sequence<_T>, delim: &_T) -> (::dafny_runtime::Sequence<_T>, ::dafny_runtime::Sequence<_T>) { - let mut i: ::std::rc::Rc> = crate::r#_StandardLibrary_Compile::_default::FindIndexMatching::<_T>(s, delim, &::dafny_runtime::int!(0)); - ( - s.take(i.value()), - s.drop(&(i.value().clone() + ::dafny_runtime::int!(1))) - ) - } - pub fn r#_SplitOnce_q<_T: ::dafny_runtime::DafnyTypeEq>(s: &::dafny_runtime::Sequence<_T>, delim: &_T) -> ::std::rc::Rc, ::dafny_runtime::Sequence<_T>)>> { - let mut valueOrError0: ::std::rc::Rc> = crate::r#_StandardLibrary_Compile::_default::FindIndexMatching::<_T>(s, delim, &::dafny_runtime::int!(0)); - if valueOrError0.IsFailure() { - valueOrError0.PropagateFailure::<(::dafny_runtime::Sequence<_T>, ::dafny_runtime::Sequence<_T>)>() - } else { - let mut i: ::dafny_runtime::_System::nat = valueOrError0.Extract(); - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::<(::dafny_runtime::Sequence<_T>, ::dafny_runtime::Sequence<_T>)>::Some { - value: ( - s.take(&i), - s.drop(&(i.clone() + ::dafny_runtime::int!(1))) - ) - }) - } - } - pub fn FindIndexMatching<_T: ::dafny_runtime::DafnyTypeEq>(s: &::dafny_runtime::Sequence<_T>, c: &_T, i: &::dafny_runtime::_System::nat) -> ::std::rc::Rc> { - crate::r#_StandardLibrary_Compile::_default::FindIndex::<_T>(s, { - let c: _T = c.clone(); - &({ - let mut c = c.clone(); - ::std::rc::Rc::new(move |x: &_T| -> bool{ - x.clone() == c.clone() - }) - }) - }, i) - } - pub fn FindIndex<_T: ::dafny_runtime::DafnyType>(s: &::dafny_runtime::Sequence<_T>, f: &::std::rc::Rc bool>, i: &::dafny_runtime::_System::nat) -> ::std::rc::Rc> { - let mut _r0 = s.clone(); - let mut _r1 = f.clone(); - let mut _r2 = i.clone(); - 'TAIL_CALL_START: loop { - let s = _r0; - let f = _r1; - let i = _r2; - if i.clone() == s.cardinality() { - return ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::<::dafny_runtime::_System::nat>::None {}); - } else { - if (&f)(&s.get(&i)) { - return ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::<::dafny_runtime::_System::nat>::Some { - value: i.clone() - }); - } else { - let mut _in4: ::dafny_runtime::Sequence<_T> = s.clone(); - let mut _in5: ::std::rc::Rc bool> = f.clone(); - let mut _in6: ::dafny_runtime::DafnyInt = i.clone() + ::dafny_runtime::int!(1); - _r0 = _in4.clone(); - _r1 = _in5.clone(); - _r2 = _in6.clone(); - continue 'TAIL_CALL_START; - } - } - } - } - pub fn Filter<_T: ::dafny_runtime::DafnyType>(s: &::dafny_runtime::Sequence<_T>, f: &::std::rc::Rc bool>) -> ::dafny_runtime::Sequence<_T> { - let mut _accumulator: ::dafny_runtime::Sequence<_T> = ::dafny_runtime::seq![] as ::dafny_runtime::Sequence<_T>; - let mut _r0 = s.clone(); - let mut _r1 = f.clone(); - 'TAIL_CALL_START: loop { - let s = _r0; - let f = _r1; - if s.cardinality() == ::dafny_runtime::int!(0) { - return _accumulator.concat(&(::dafny_runtime::seq![] as ::dafny_runtime::Sequence<_T>)); - } else { - if (&f)(&s.get(&::dafny_runtime::int!(0))) { - _accumulator = _accumulator.concat(&::dafny_runtime::seq![s.get(&::dafny_runtime::int!(0))]); - let mut _in7: ::dafny_runtime::Sequence<_T> = s.drop(&::dafny_runtime::int!(1)); - let mut _in8: ::std::rc::Rc bool> = f.clone(); - _r0 = _in7.clone(); - _r1 = _in8.clone(); - continue 'TAIL_CALL_START; - } else { - let mut _in9: ::dafny_runtime::Sequence<_T> = s.drop(&::dafny_runtime::int!(1)); - let mut _in10: ::std::rc::Rc bool> = f.clone(); - _r0 = _in9.clone(); - _r1 = _in10.clone(); - continue 'TAIL_CALL_START; - } - } - } - } - pub fn Min(a: &::dafny_runtime::DafnyInt, b: &::dafny_runtime::DafnyInt) -> ::dafny_runtime::DafnyInt { - if a.clone() < b.clone() { - a.clone() - } else { - b.clone() - } - } - pub fn Fill<_T: ::dafny_runtime::DafnyType>(value: &_T, n: &::dafny_runtime::_System::nat) -> ::dafny_runtime::Sequence<_T> { - { - let _initializer = { - let value: _T = value.clone(); - { - let mut value = value.clone(); - ::std::rc::Rc::new(move |_v0: &::dafny_runtime::DafnyInt| -> _T{ - value.clone() - }) - } - }; - ::dafny_runtime::integer_range(::dafny_runtime::Zero::zero(), n.clone()).map(|i| _initializer(&i)).collect::<::dafny_runtime::Sequence<_>>() - } - } - pub fn SeqToArray<_T: ::dafny_runtime::DafnyType>(s: &::dafny_runtime::Sequence<_T>) -> ::dafny_runtime::Object<[_T]> { - let mut a = ::dafny_runtime::MaybePlacebo::<::dafny_runtime::Object<[_T]>>::new(); - let mut _init0: ::std::rc::Rc _T> = { - let s: ::dafny_runtime::Sequence<_T> = s.clone(); - { - let mut s = s.clone(); - ::std::rc::Rc::new(move |i: &::dafny_runtime::DafnyInt| -> _T{ - s.get(i) - }) - } - }; - let mut _nw2: ::dafny_runtime::Object<[::std::mem::MaybeUninit<_T>]> = ::dafny_runtime::array::placebos_usize_object::<_T>(::dafny_runtime::DafnyUsize::into_usize(s.cardinality())); - for r#__i0_0 in ::dafny_runtime::integer_range(0, ::dafny_runtime::rd!(_nw2.clone()).len()) { - { - let __idx0 = ::dafny_runtime::DafnyUsize::into_usize(r#__i0_0.clone()); - ::dafny_runtime::md!(_nw2)[__idx0] = ::std::mem::MaybeUninit::new((&_init0)(&::dafny_runtime::int!(r#__i0_0.clone()))); - } - } - a = ::dafny_runtime::MaybePlacebo::from(::dafny_runtime::array::construct_object(_nw2.clone())); - return a.read(); - } - pub fn LexicographicLessOrEqual<_T: ::dafny_runtime::DafnyTypeEq>(a: &::dafny_runtime::Sequence<_T>, b: &::dafny_runtime::Sequence<_T>, less: &::std::rc::Rc bool>) -> bool { - ::dafny_runtime::integer_range(::dafny_runtime::int!(0), a.cardinality() + ::dafny_runtime::int!(1)).any(({ - let mut a = a.clone(); - let mut b = b.clone(); - let mut less = less.clone(); - ::std::rc::Rc::new(move |r#__exists_var_0: ::dafny_runtime::DafnyInt| -> bool{ - let mut k: ::dafny_runtime::DafnyInt = r#__exists_var_0.clone(); - ::dafny_runtime::int!(0) <= k.clone() && k.clone() <= a.cardinality() && crate::r#_StandardLibrary_Compile::_default::LexicographicLessOrEqualAux::<_T>(&a, &b, &less, &k) - }) - }).as_ref()) - } - pub fn LexicographicLessOrEqualAux<_T: ::dafny_runtime::DafnyTypeEq>(a: &::dafny_runtime::Sequence<_T>, b: &::dafny_runtime::Sequence<_T>, less: &::std::rc::Rc bool>, lengthOfCommonPrefix: &::dafny_runtime::_System::nat) -> bool { - lengthOfCommonPrefix.clone() <= b.cardinality() && ::dafny_runtime::integer_range(::dafny_runtime::int!(0), lengthOfCommonPrefix.clone()).all(({ - let mut lengthOfCommonPrefix = lengthOfCommonPrefix.clone(); - let mut a = a.clone(); - let mut b = b.clone(); - ::std::rc::Rc::new(move |r#__forall_var_0: ::dafny_runtime::DafnyInt| -> bool{ - let mut i: ::dafny_runtime::DafnyInt = r#__forall_var_0.clone(); - !(::dafny_runtime::int!(0) <= i.clone() && i.clone() < lengthOfCommonPrefix.clone()) || a.get(&i) == b.get(&i) - }) - }).as_ref()) && (lengthOfCommonPrefix.clone() == a.cardinality() || lengthOfCommonPrefix.clone() < b.cardinality() && less(&a.get(lengthOfCommonPrefix), &b.get(lengthOfCommonPrefix))) - } - pub fn SetToOrderedSequence<_T: ::dafny_runtime::DafnyTypeEq>(s: &::dafny_runtime::Set<::dafny_runtime::Sequence<_T>>, less: &::std::rc::Rc bool>) -> ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>> { - let mut _accumulator: ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>> = ::dafny_runtime::seq![] as ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>>; - let mut _r0 = s.clone(); - let mut _r1 = less.clone(); - 'TAIL_CALL_START: loop { - let s = _r0; - let less = _r1; - if s.clone() == ::dafny_runtime::set!{} { - return _accumulator.concat(&(::dafny_runtime::seq![] as ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>>)); - } else { - return (&({ - let mut s = s.clone(); - let mut less = less.clone(); - ::std::rc::Rc::new(move |r#__let_dummy_0: &::dafny_runtime::DafnyInt| -> ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>>{ - let mut a = ::dafny_runtime::MaybePlacebo::<::dafny_runtime::Sequence<_T>>::new(); - 'label_goto__ASSIGN_SUCH_THAT_0: loop { - for r#__assign_such_that_0 in (&s).iter().cloned() { - a = ::dafny_runtime::MaybePlacebo::from(r#__assign_such_that_0.clone()); - if s.contains(&a.read()) && crate::r#_StandardLibrary_Compile::_default::IsMinimum::<_T>(&a.read(), &s, &less) { - break 'label_goto__ASSIGN_SUCH_THAT_0; - } - } - panic!("Halt"); - break; - }; - ::dafny_runtime::seq![a.read()].concat(&crate::r#_StandardLibrary_Compile::_default::SetToOrderedSequence::<_T>(&s.subtract(&::dafny_runtime::set!{a.read()}), &less)) - }) - }))(&::dafny_runtime::int!(0)); - } - } - } - pub fn IsMinimum<_T: ::dafny_runtime::DafnyTypeEq>(a: &::dafny_runtime::Sequence<_T>, s: &::dafny_runtime::Set<::dafny_runtime::Sequence<_T>>, less: &::std::rc::Rc bool>) -> bool { - s.contains(a) && s.iter().all(({ - let mut a = a.clone(); - let mut s = s.clone(); - let mut less = less.clone(); - ::std::rc::Rc::new(move |r#__forall_var_1: &::dafny_runtime::Sequence<_T>| -> bool{ - let mut z: ::dafny_runtime::Sequence<_T> = r#__forall_var_1.clone(); - !s.contains(&z) || crate::r#_StandardLibrary_Compile::_default::LexicographicLessOrEqual::<_T>(&a, &z, &less) - }) - }).as_ref()) - } - } - - pub mod r#_UInt_Compile { - pub use ::std::default::Default; - pub use ::dafny_runtime::DafnyPrint; - - pub struct _default {} - - impl _default { - pub fn UInt8Less(a: u8, b: u8) -> bool { - a < b - } - pub fn HasUint16Len<_T: ::dafny_runtime::DafnyType>(s: &::dafny_runtime::Sequence<_T>) -> bool { - s.cardinality() < crate::r#_StandardLibrary_Compile::r#_UInt_Compile::_default::UINT16_LIMIT() - } - pub fn HasUint32Len<_T: ::dafny_runtime::DafnyType>(s: &::dafny_runtime::Sequence<_T>) -> bool { - s.cardinality() < crate::r#_StandardLibrary_Compile::r#_UInt_Compile::_default::UINT32_LIMIT() - } - pub fn HasUint64Len<_T: ::dafny_runtime::DafnyType>(s: &::dafny_runtime::Sequence<_T>) -> bool { - s.cardinality() < crate::r#_StandardLibrary_Compile::r#_UInt_Compile::_default::UINT64_LIMIT() - } - pub fn UInt16ToSeq(x: u16) -> ::dafny_runtime::Sequence { - let mut b0: u8 = (x / 256) as u8; - let mut b1: u8 = (x % 256) as u8; - ::dafny_runtime::seq![b0, b1] - } - pub fn SeqToUInt16(s: &::dafny_runtime::Sequence) -> u16 { - let mut x0: u16 = s.get(&::dafny_runtime::int!(0)) as u16 * 256; - x0 + s.get(&::dafny_runtime::int!(1)) as u16 - } - pub fn UInt32ToSeq(x: u32) -> ::dafny_runtime::Sequence { - let mut b0: u8 = (x / 16777216) as u8; - let mut x0: u32 = x - b0 as u32 * 16777216; - let mut b1: u8 = (x0 / 65536) as u8; - let mut x1: u32 = x0 - b1 as u32 * 65536; - let mut b2: u8 = (x1 / 256) as u8; - let mut b3: u8 = (x1 % 256) as u8; - ::dafny_runtime::seq![b0, b1, b2, b3] - } - pub fn SeqToUInt32(s: &::dafny_runtime::Sequence) -> u32 { - let mut x0: u32 = s.get(&::dafny_runtime::int!(0)) as u32 * 16777216; - let mut x1: u32 = x0 + s.get(&::dafny_runtime::int!(1)) as u32 * 65536; - let mut x2: u32 = x1 + s.get(&::dafny_runtime::int!(2)) as u32 * 256; - x2 + s.get(&::dafny_runtime::int!(3)) as u32 - } - pub fn UInt64ToSeq(x: u64) -> ::dafny_runtime::Sequence { - let mut b0: u8 = (x / 72057594037927936) as u8; - let mut x0: u64 = x - b0 as u64 * 72057594037927936; - let mut b1: u8 = (x0 / 281474976710656) as u8; - let mut x1: u64 = x0 - b1 as u64 * 281474976710656; - let mut b2: u8 = (x1 / 1099511627776) as u8; - let mut x2: u64 = x1 - b2 as u64 * 1099511627776; - let mut b3: u8 = (x2 / 4294967296) as u8; - let mut x3: u64 = x2 - b3 as u64 * 4294967296; - let mut b4: u8 = (x3 / 16777216) as u8; - let mut x4: u64 = x3 - b4 as u64 * 16777216; - let mut b5: u8 = (x4 / 65536) as u8; - let mut x5: u64 = x4 - b5 as u64 * 65536; - let mut b6: u8 = (x5 / 256) as u8; - let mut b7: u8 = (x5 % 256) as u8; - ::dafny_runtime::seq![b0, b1, b2, b3, b4, b5, b6, b7] - } - pub fn SeqToUInt64(s: &::dafny_runtime::Sequence) -> u64 { - let mut x0: u64 = s.get(&::dafny_runtime::int!(0)) as u64 * 72057594037927936; - let mut x1: u64 = x0 + s.get(&::dafny_runtime::int!(1)) as u64 * 281474976710656; - let mut x2: u64 = x1 + s.get(&::dafny_runtime::int!(2)) as u64 * 1099511627776; - let mut x3: u64 = x2 + s.get(&::dafny_runtime::int!(3)) as u64 * 4294967296; - let mut x4: u64 = x3 + s.get(&::dafny_runtime::int!(4)) as u64 * 16777216; - let mut x5: u64 = x4 + s.get(&::dafny_runtime::int!(5)) as u64 * 65536; - let mut x6: u64 = x5 + s.get(&::dafny_runtime::int!(6)) as u64 * 256; - let mut x: u64 = x6 + s.get(&::dafny_runtime::int!(7)) as u64; - x - } - pub fn UINT16_LIMIT() -> ::dafny_runtime::DafnyInt { - ::dafny_runtime::int!(b"65536") - } - pub fn UINT32_LIMIT() -> ::dafny_runtime::DafnyInt { - ::dafny_runtime::int!(b"4294967296") - } - pub fn UINT64_LIMIT() -> ::dafny_runtime::DafnyInt { - ::dafny_runtime::int!(b"18446744073709551616") - } - pub fn INT32_MAX_LIMIT() -> ::dafny_runtime::DafnyInt { - ::dafny_runtime::int!(b"2147483648") - } - pub fn INT64_MAX_LIMIT() -> ::dafny_runtime::DafnyInt { - ::dafny_runtime::int!(b"9223372036854775808") - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct uint8(pub u8); - - impl uint8 { - pub fn is(_source: u8) -> bool { - return true; - } - } - - impl Default - for uint8 { - fn default() -> Self { - uint8(::std::default::Default::default()) - } - } - - impl DafnyPrint - for uint8 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for uint8 { - type Target = u8; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct uint16(pub u16); - - impl uint16 { - pub fn is(_source: u16) -> bool { - return true; - } - } - - impl Default - for uint16 { - fn default() -> Self { - uint16(::std::default::Default::default()) - } - } - - impl DafnyPrint - for uint16 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for uint16 { - type Target = u16; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct uint32(pub u32); - - impl uint32 { - pub fn is(_source: u32) -> bool { - return true; - } - } - - impl Default - for uint32 { - fn default() -> Self { - uint32(::std::default::Default::default()) - } - } - - impl DafnyPrint - for uint32 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for uint32 { - type Target = u32; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct uint64(pub u64); - - impl uint64 { - pub fn is(_source: u64) -> bool { - return true; - } - } - - impl Default - for uint64 { - fn default() -> Self { - uint64(::std::default::Default::default()) - } - } - - impl DafnyPrint - for uint64 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for uint64 { - type Target = u64; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct int32(pub i32); - - impl int32 { - pub fn is(_source: i32) -> bool { - return true; - } - } - - impl Default - for int32 { - fn default() -> Self { - int32(::std::default::Default::default()) - } - } - - impl DafnyPrint - for int32 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for int32 { - type Target = i32; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct int64(pub i64); - - impl int64 { - pub fn is(_source: i64) -> bool { - return true; - } - } - - impl Default - for int64 { - fn default() -> Self { - int64(::std::default::Default::default()) - } - } - - impl DafnyPrint - for int64 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for int64 { - type Target = i64; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct posInt64(pub u64); - - impl posInt64 { - pub fn is(_source: u64) -> bool { - let mut x: ::dafny_runtime::DafnyInt = ::std::convert::Into::<::dafny_runtime::DafnyInt>::into(_source.clone()); - return ::dafny_runtime::int!(0) < x.clone() && x.clone() < ::dafny_runtime::int!(b"9223372036854775808"); - } - } - - impl Default - for posInt64 { - fn default() -> Self { - posInt64(1) - } - } - - impl DafnyPrint - for posInt64 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for posInt64 { - type Target = u64; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - pub type seq16 = ::dafny_runtime::Sequence; - - pub type seq32 = ::dafny_runtime::Sequence; - - pub type seq64 = ::dafny_runtime::Sequence; - } -} -pub mod r#_StandardLibraryInterop_Compile { - pub use ::dafny_runtime::UpcastObject; - pub use ::std::any::Any; - - pub struct WrappersInterop {} - - impl WrappersInterop { - pub fn _allocate_object() -> ::dafny_runtime::Object { - ::dafny_runtime::allocate_object::() - } - pub fn CreateStringSome(s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> ::std::rc::Rc>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Some { - value: s.clone() - }) - } - pub fn CreateStringNone() -> ::std::rc::Rc>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::None {}) - } - pub fn CreateBooleanSome(b: bool) -> ::std::rc::Rc> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::::Some { - value: b - }) - } - pub fn CreateBooleanNone() -> ::std::rc::Rc> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::::None {}) - } - } - - impl UpcastObject - for WrappersInterop { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); - } -} -pub mod UTF8 { - pub struct _default {} - - impl _default { - pub fn CreateEncodeSuccess(bytes: &crate::UTF8::ValidUTF8Bytes) -> ::std::rc::Rc>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::>::Success { - value: bytes.clone() - }) - } - pub fn CreateEncodeFailure(error: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> ::std::rc::Rc>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::>::Failure { - error: error.clone() - }) - } - pub fn CreateDecodeSuccess(s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> ::std::rc::Rc, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { - value: s.clone() - }) - } - pub fn CreateDecodeFailure(error: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> ::std::rc::Rc, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { - error: error.clone() - }) - } - pub fn IsASCIIString(s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> bool { - let mut _hresult: bool = ::default(); - let mut _hi0: ::dafny_runtime::DafnyInt = s.cardinality(); - for i in ::dafny_runtime::integer_range(::dafny_runtime::int!(0), _hi0.clone()) { - if !(::dafny_runtime::int!(s.get(&i).0) < ::dafny_runtime::int!(128)) { - _hresult = false; - return _hresult; - } - } - _hresult = true; - return _hresult; - } - pub fn EncodeAscii(s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> crate::UTF8::ValidUTF8Bytes { - let mut _accumulator: crate::UTF8::ValidUTF8Bytes = ::dafny_runtime::seq![] as ::dafny_runtime::Sequence; - let mut _r0 = s.clone(); - 'TAIL_CALL_START: loop { - let s = _r0; - if s.cardinality() == ::dafny_runtime::int!(0) { - return _accumulator.concat(&(::dafny_runtime::seq![] as ::dafny_runtime::Sequence)); - } else { - let mut x: ::dafny_runtime::Sequence = ::dafny_runtime::seq![s.get(&::dafny_runtime::int!(0)).0 as u8]; - _accumulator = _accumulator.concat(&x); - let mut _in11: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> = s.drop(&::dafny_runtime::int!(1)); - _r0 = _in11.clone(); - continue 'TAIL_CALL_START; - } - } - } - pub fn Uses1Byte(s: &::dafny_runtime::Sequence) -> bool { - 0 <= s.get(&::dafny_runtime::int!(0)) && s.get(&::dafny_runtime::int!(0)) <= 127 - } - pub fn Uses2Bytes(s: &::dafny_runtime::Sequence) -> bool { - 194 <= s.get(&::dafny_runtime::int!(0)) && s.get(&::dafny_runtime::int!(0)) <= 223 && (128 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 191) - } - pub fn Uses3Bytes(s: &::dafny_runtime::Sequence) -> bool { - s.get(&::dafny_runtime::int!(0)) == 224 && (160 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) || 225 <= s.get(&::dafny_runtime::int!(0)) && s.get(&::dafny_runtime::int!(0)) <= 236 && (128 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) || s.get(&::dafny_runtime::int!(0)) == 237 && (128 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 159) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) || 238 <= s.get(&::dafny_runtime::int!(0)) && s.get(&::dafny_runtime::int!(0)) <= 239 && (128 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) - } - pub fn Uses4Bytes(s: &::dafny_runtime::Sequence) -> bool { - s.get(&::dafny_runtime::int!(0)) == 240 && (144 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(3)) && s.get(&::dafny_runtime::int!(3)) <= 191) || 241 <= s.get(&::dafny_runtime::int!(0)) && s.get(&::dafny_runtime::int!(0)) <= 243 && (128 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(3)) && s.get(&::dafny_runtime::int!(3)) <= 191) || s.get(&::dafny_runtime::int!(0)) == 244 && (128 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 143) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(3)) && s.get(&::dafny_runtime::int!(3)) <= 191) - } - pub fn ValidUTF8Range(a: &::dafny_runtime::Sequence, lo: &::dafny_runtime::_System::nat, hi: &::dafny_runtime::_System::nat) -> bool { - let mut _r0 = a.clone(); - let mut _r1 = lo.clone(); - let mut _r2 = hi.clone(); - 'TAIL_CALL_START: loop { - let a = _r0; - let lo = _r1; - let hi = _r2; - if lo.clone() == hi.clone() { - return true; - } else { - let mut r: ::dafny_runtime::Sequence = a.slice(&lo, &hi); - if crate::UTF8::_default::Uses1Byte(&r) { - let mut _in12: ::dafny_runtime::Sequence = a.clone(); - let mut _in13: ::dafny_runtime::DafnyInt = lo.clone() + ::dafny_runtime::int!(1); - let mut _in14: ::dafny_runtime::_System::nat = hi.clone(); - _r0 = _in12.clone(); - _r1 = _in13.clone(); - _r2 = _in14.clone(); - continue 'TAIL_CALL_START; - } else { - if ::dafny_runtime::int!(2) <= r.cardinality() && crate::UTF8::_default::Uses2Bytes(&r) { - let mut _in15: ::dafny_runtime::Sequence = a.clone(); - let mut _in16: ::dafny_runtime::DafnyInt = lo.clone() + ::dafny_runtime::int!(2); - let mut _in17: ::dafny_runtime::_System::nat = hi.clone(); - _r0 = _in15.clone(); - _r1 = _in16.clone(); - _r2 = _in17.clone(); - continue 'TAIL_CALL_START; - } else { - if ::dafny_runtime::int!(3) <= r.cardinality() && crate::UTF8::_default::Uses3Bytes(&r) { - let mut _in18: ::dafny_runtime::Sequence = a.clone(); - let mut _in19: ::dafny_runtime::DafnyInt = lo.clone() + ::dafny_runtime::int!(3); - let mut _in20: ::dafny_runtime::_System::nat = hi.clone(); - _r0 = _in18.clone(); - _r1 = _in19.clone(); - _r2 = _in20.clone(); - continue 'TAIL_CALL_START; - } else { - if ::dafny_runtime::int!(4) <= r.cardinality() && crate::UTF8::_default::Uses4Bytes(&r) { - let mut _in21: ::dafny_runtime::Sequence = a.clone(); - let mut _in22: ::dafny_runtime::DafnyInt = lo.clone() + ::dafny_runtime::int!(4); - let mut _in23: ::dafny_runtime::_System::nat = hi.clone(); - _r0 = _in21.clone(); - _r1 = _in22.clone(); - _r2 = _in23.clone(); - continue 'TAIL_CALL_START; - } else { - return false; - } - } - } - } - } - } - } - pub fn ValidUTF8Seq(s: &::dafny_runtime::Sequence) -> bool { - crate::UTF8::_default::ValidUTF8Range(s, &::dafny_runtime::int!(0), &s.cardinality()) - } - } - - pub type ValidUTF8Bytes = ::dafny_runtime::Sequence; - - pub fn r#__init_ValidUTF8Bytes() -> ::dafny_runtime::Sequence { - ::dafny_runtime::seq![] as ::dafny_runtime::Sequence - } -} -pub mod r#_Wrappers_Compile { - pub use ::std::fmt::Debug; - pub use ::dafny_runtime::DafnyPrint; - pub use ::std::cmp::Eq; - pub use ::std::hash::Hash; - pub use ::std::default::Default; - pub use ::std::convert::AsRef; - - pub struct _default {} - - impl _default { - pub fn Need<_E: ::dafny_runtime::DafnyType>(condition: bool, error: &_E) -> ::std::rc::Rc> { - if condition { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Outcome::<_E>::Pass {}) - } else { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Outcome::<_E>::Fail { - error: error.clone() - }) - } - } - } - - #[derive(PartialEq, Clone)] - pub enum Option { - None {}, - Some { - value: T - } - } - - impl Option { - pub fn ToResult(self: &::std::rc::Rc) -> ::std::rc::Rc>> { - let mut _source0: ::std::rc::Rc> = self.clone(); - if matches!((&_source0).as_ref(), crate::r#_Wrappers_Compile::Option::None{ .. }) { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::>::Failure { - error: ::dafny_runtime::string_utf16_of("Option is None") - }) - } else { - let mut r#___mcc_h0: T = _source0.value().clone(); - let mut v: T = r#___mcc_h0.clone(); - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::>::Success { - value: v.clone() - }) - } - } - pub fn UnwrapOr(self: &::std::rc::Rc, default: &T) -> T { - let mut _source1: ::std::rc::Rc> = self.clone(); - if matches!((&_source1).as_ref(), crate::r#_Wrappers_Compile::Option::None{ .. }) { - default.clone() - } else { - let mut r#___mcc_h0: T = _source1.value().clone(); - let mut v: T = r#___mcc_h0.clone(); - v.clone() - } - } - pub fn IsFailure(self: &::std::rc::Rc) -> bool { - matches!(self.as_ref(), crate::r#_Wrappers_Compile::Option::None{ .. }) - } - pub fn PropagateFailure<_U: ::dafny_runtime::DafnyType>(self: &::std::rc::Rc) -> ::std::rc::Rc> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::<_U>::None {}) - } - pub fn Extract(self: &::std::rc::Rc) -> T { - self.value().clone() - } - pub fn value(&self) -> &T { - match self { - Option::None{} => panic!("field does not exist on this variant"), - Option::Some{value, } => value, - } - } - } - - impl Debug - for Option { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Option { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Option::None{} => { - write!(_formatter, "Wrappers_Compile.Option.None")?; - Ok(()) - }, - Option::Some{value, } => { - write!(_formatter, "Wrappers_Compile.Option.Some(")?; - ::dafny_runtime::DafnyPrint::fmt_print(value, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Option { - pub fn coerce(f_0: ::std::rc::Rc r#__T0 + 'static>) -> ::std::rc::Rc) -> Option> { - ::std::rc::Rc::new(move |this: Self| -> Option{ - match this { - Option::None{} => { - Option::None {} - }, - Option::Some{value, } => { - Option::Some { - value: f_0.clone()(value) - } - }, - } - }) - } - } - - impl Eq - for Option {} - - impl Hash - for Option { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - Option::None{} => { - - }, - Option::Some{value, } => { - ::std::hash::Hash::hash(value, _state) - }, - } - } - } - - impl Default - for Option { - fn default() -> Option { - Option::None {} - } - } - - impl AsRef> - for &Option { - fn as_ref(&self) -> Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Result { - Success { - value: T - }, - Failure { - error: R - } - } - - impl Result { - pub fn ToOption(self: &::std::rc::Rc) -> ::std::rc::Rc> { - let mut _source2: ::std::rc::Rc> = self.clone(); - if matches!((&_source2).as_ref(), crate::r#_Wrappers_Compile::Result::Success{ .. }) { - let mut r#___mcc_h0: T = _source2.value().clone(); - let mut s: T = r#___mcc_h0.clone(); - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::::Some { - value: s.clone() - }) - } else { - let mut r#___mcc_h1: R = _source2.error().clone(); - let mut e: R = r#___mcc_h1.clone(); - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::::None {}) - } - } - pub fn UnwrapOr(self: &::std::rc::Rc, default: &T) -> T { - let mut _source3: ::std::rc::Rc> = self.clone(); - if matches!((&_source3).as_ref(), crate::r#_Wrappers_Compile::Result::Success{ .. }) { - let mut r#___mcc_h0: T = _source3.value().clone(); - let mut s: T = r#___mcc_h0.clone(); - s.clone() - } else { - let mut r#___mcc_h1: R = _source3.error().clone(); - let mut e: R = r#___mcc_h1.clone(); - default.clone() - } - } - pub fn IsFailure(self: &::std::rc::Rc) -> bool { - matches!(self.as_ref(), crate::r#_Wrappers_Compile::Result::Failure{ .. }) - } - pub fn PropagateFailure<_U: ::dafny_runtime::DafnyType>(self: &::std::rc::Rc) -> ::std::rc::Rc> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<_U, R>::Failure { - error: self.error().clone() - }) - } - pub fn MapFailure<_NewR: ::dafny_runtime::DafnyType>(self: &::std::rc::Rc, reWrap: &::std::rc::Rc _NewR>) -> ::std::rc::Rc> { - let mut _source4: ::std::rc::Rc> = self.clone(); - if matches!((&_source4).as_ref(), crate::r#_Wrappers_Compile::Result::Success{ .. }) { - let mut r#___mcc_h0: T = _source4.value().clone(); - let mut s: T = r#___mcc_h0.clone(); - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::::Success { - value: s.clone() - }) - } else { - let mut r#___mcc_h1: R = _source4.error().clone(); - let mut e: R = r#___mcc_h1.clone(); - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::::Failure { - error: reWrap(&e) - }) - } - } - pub fn Extract(self: &::std::rc::Rc) -> T { - self.value().clone() - } - pub fn value(&self) -> &T { - match self { - Result::Success{value, } => value, - Result::Failure{error, } => panic!("field does not exist on this variant"), - } - } - pub fn error(&self) -> &R { - match self { - Result::Success{value, } => panic!("field does not exist on this variant"), - Result::Failure{error, } => error, - } - } - } - - impl Debug - for Result { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Result { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Result::Success{value, } => { - write!(_formatter, "Wrappers_Compile.Result.Success(")?; - ::dafny_runtime::DafnyPrint::fmt_print(value, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - Result::Failure{error, } => { - write!(_formatter, "Wrappers_Compile.Result.Failure(")?; - ::dafny_runtime::DafnyPrint::fmt_print(error, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Result { - pub fn coerce(f_0: ::std::rc::Rc r#__T0 + 'static>, f_1: ::std::rc::Rc r#__T1 + 'static>) -> ::std::rc::Rc) -> Result> { - ::std::rc::Rc::new(move |this: Self| -> Result{ - match this { - Result::Success{value, } => { - Result::Success { - value: f_0.clone()(value) - } - }, - Result::Failure{error, } => { - Result::Failure { - error: f_1.clone()(error) - } - }, - } - }) - } - } - - impl Eq - for Result {} - - impl Hash - for Result { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - Result::Success{value, } => { - ::std::hash::Hash::hash(value, _state) - }, - Result::Failure{error, } => { - ::std::hash::Hash::hash(error, _state) - }, - } - } - } - - impl Default - for Result { - fn default() -> Result { - Result::Success { - value: ::std::default::Default::default() - } - } - } - - impl AsRef> - for &Result { - fn as_ref(&self) -> Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Outcome { - Pass {}, - Fail { - error: E - } - } - - impl Outcome { - pub fn IsFailure(self: &::std::rc::Rc) -> bool { - matches!(self.as_ref(), crate::r#_Wrappers_Compile::Outcome::Fail{ .. }) - } - pub fn PropagateFailure<_U: ::dafny_runtime::DafnyType>(self: &::std::rc::Rc) -> ::std::rc::Rc> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<_U, E>::Failure { - error: self.error().clone() - }) - } - pub fn error(&self) -> &E { - match self { - Outcome::Pass{} => panic!("field does not exist on this variant"), - Outcome::Fail{error, } => error, - } - } - } - - impl Debug - for Outcome { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Outcome { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Outcome::Pass{} => { - write!(_formatter, "Wrappers_Compile.Outcome.Pass")?; - Ok(()) - }, - Outcome::Fail{error, } => { - write!(_formatter, "Wrappers_Compile.Outcome.Fail(")?; - ::dafny_runtime::DafnyPrint::fmt_print(error, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Eq - for Outcome {} - - impl Hash - for Outcome { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - Outcome::Pass{} => { - - }, - Outcome::Fail{error, } => { - ::std::hash::Hash::hash(error, _state) - }, - } - } - } - - impl Default - for Outcome { - fn default() -> Outcome { - Outcome::Pass {} - } - } - - impl AsRef> - for &Outcome { - fn as_ref(&self) -> Self { - self - } - } -} \ No newline at end of file diff --git a/TestModels/Errors/runtimes/rust/src/standard_library_externs.rs b/TestModels/Errors/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/Errors/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/LanguageSpecificLogic/runtimes/rust/src/standard_library_externs.rs b/TestModels/LanguageSpecificLogic/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/LanguageSpecificLogic/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/Refinement/runtimes/rust/src/standard_library_externs.rs b/TestModels/Refinement/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/Refinement/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/Resource/runtimes/rust/src/standard_library_externs.rs b/TestModels/Resource/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/Resource/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/SimpleTypes/SimpleBlob/Makefile b/TestModels/SimpleTypes/SimpleBlob/Makefile index b19193a77..c0d33c2e1 100644 --- a/TestModels/SimpleTypes/SimpleBlob/Makefile +++ b/TestModels/SimpleTypes/SimpleBlob/Makefile @@ -3,8 +3,9 @@ CORES=2 +TRANSPILE_TESTS_IN_RUST=1 + ENABLE_EXTERN_PROCESSING=1 -RUST_BENERATED=1 include ../../SharedMakefile.mk diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/Cargo.toml b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/Cargo.toml index 7db289b45..743b97c03 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/Cargo.toml +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/Cargo.toml @@ -5,13 +5,19 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +wrapped-client = [] + [dependencies] aws-smithy-runtime = {version = "1.6.0", features = ["client"] } aws-smithy-runtime-api = {version = "1.7.0", features = ["client"] } aws-smithy-types = "1.2.0" dafny_runtime = { path = "../../../../dafny-dependencies/dafny_runtime_rust"} -[dev-dependencies.tokio] +[dev-dependencies] +simple_blob = { path = ".", features = ["wrapped-client"] } + +[dependencies.tokio] version = "1.26.0" features = ["full"] diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client.rs index 0e7fbefea..71235fc03 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use aws_smithy_types::error::operation::BuildError; #[derive(::std::clone::Clone, ::std::fmt::Debug)] @@ -13,9 +14,10 @@ impl Client { pub fn from_conf( conf: crate::types::simple_blob_config::SimpleBlobConfig, ) -> Result { - let inner = crate::simple::types::blob::internaldafny::_default::SimpleBlob( - &crate::conversions::simple_blob_config::_simple_blob_config::to_dafny(conf), - ); + let inner = + crate::simple::types::blob::internaldafny::_default::SimpleBlob( + &crate::conversions::simple_blob_config::_simple_blob_config::to_dafny(conf), + ); if matches!( inner.as_ref(), crate::_Wrappers_Compile::Result::Failure { .. } @@ -28,11 +30,11 @@ impl Client { )); } Ok(Self { - dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), + dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) }) } } mod get_blob; -mod get_blob_known_value; +mod get_blob_known_value_test; diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob.rs index c09128d41..4247bbc32 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob.rs @@ -1,11 +1,13 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { /// Constructs a fluent builder for the [`GetBlob`](crate::operation::get_blob::builders::GetBlobFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(impl Into<::dafny_runtime::Sequence>)`](crate::operation::get_blob::builders::GetBlobFluentBuilder::value) / [`set_value(Option<::dafny_runtime::Sequence>)`](crate::operation::get_blob::builders::GetBlobFluentBuilder::set_value):(undocumented)
+ /// - [`value(impl Into>)`](crate::operation::get_blob::builders::GetBlobFluentBuilder::value) / [`set_value(Option<::aws_smithy_types::Blob>)`](crate::operation::get_blob::builders::GetBlobFluentBuilder::set_value): (undocumented)
/// - On success, responds with [`GetBlobOutput`](crate::operation::get_blob::GetBlobOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_blob::GetBlobOutput::value): (undocumented) + /// - [`value(Option<::aws_smithy_types::Blob>)`](crate::operation::get_blob::GetBlobOutput::value): (undocumented) /// - On failure, responds with [`SdkError`](crate::operation::get_blob::GetBlobError) pub fn get_blob(&self) -> crate::operation::get_blob::builders::GetBlobFluentBuilder { crate::operation::get_blob::builders::GetBlobFluentBuilder::new(self.clone()) diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob_known_value.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob_known_value.rs deleted file mode 100644 index a8831d242..000000000 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob_known_value.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -impl super::Client { - /// Constructs a fluent builder for the [`GetBlob`](crate::operation::get_blob_known_value::builders::GetBlobFluentBuilder) operation. - /// - /// - The fluent builder is configurable: - /// - [`value(impl Into<::dafny_runtime::Sequence>)`](crate::operation::get_blob_known_value::builders::GetBlobFluentBuilder::value) / [`set_value(Option<::dafny_runtime::Sequence>)`](crate::operation::get_blob_known_value::builders::GetBlobFluentBuilder::set_value):(undocumented)
- /// - On success, responds with [`GetBlobOutput`](crate::operation::get_blob_known_value::GetBlobOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_blob_known_value::GetBlobOutput::value): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::get_blob_known_value::GetBlobError) - pub fn get_blob_known_value( - &self, - ) -> crate::operation::get_blob_known_value::builders::GetBlobKnownValueFluentBuilder { - crate::operation::get_blob_known_value::builders::GetBlobKnownValueFluentBuilder::new( - self.clone(), - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob_known_value_test.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob_known_value_test.rs new file mode 100644 index 000000000..eec5e197f --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob_known_value_test.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +impl super::Client { + /// Constructs a fluent builder for the [`GetBlobKnownValueTest`](crate::operation::get_blob_known_value_test::builders::GetBlobKnownValueTestFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`value(impl Into>)`](crate::operation::get_blob_known_value_test::builders::GetBlobKnownValueTestFluentBuilder::value) / [`set_value(Option<::aws_smithy_types::Blob>)`](crate::operation::get_blob_known_value_test::builders::GetBlobKnownValueTestFluentBuilder::set_value): (undocumented)
+ /// - On success, responds with [`GetBlobOutput`](crate::operation::get_blob_known_value_test::GetBlobOutput) with field(s): + /// - [`value(Option<::aws_smithy_types::Blob>)`](crate::operation::get_blob_known_value_test::GetBlobOutput::value): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_blob_known_value_test::GetBlobKnownValueTestError) + pub fn get_blob_known_value_test(&self) -> crate::operation::get_blob_known_value_test::builders::GetBlobKnownValueTestFluentBuilder { + crate::operation::get_blob_known_value_test::builders::GetBlobKnownValueTestFluentBuilder::new(self.clone()) + } +} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions.rs index 1cd4ad224..cf1c199d5 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions.rs @@ -1,6 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub mod get_blob; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod error; -pub mod get_blob_known_value; + pub mod get_blob; -pub mod simple_blob_config; + pub mod get_blob_known_value_test; + + pub mod simple_blob_config; diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/error.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/error.rs new file mode 100644 index 000000000..6d52bba84 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/error.rs @@ -0,0 +1,32 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + /// Wraps up an arbitrary Rust Error value as a Dafny Error +pub fn to_opaque_error(value: E) -> + ::std::rc::Rc +{ + let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( + ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), + )); + ::std::rc::Rc::new( + crate::r#simple::types::blob::internaldafny::types::Error::Opaque { + obj: error_obj, + }, + ) +} + +/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure +pub fn to_opaque_error_result(value: E) -> + ::std::rc::Rc< + crate::_Wrappers_Compile::Result< + T, + ::std::rc::Rc + > + > +{ + ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: to_opaque_error(value), + }, + ) +} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob.rs index 43479fd3c..d38674b06 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] @@ -7,14 +8,9 @@ pub fn to_dafny_error( value: crate::operation::get_blob::GetBlobError, ) -> ::std::rc::Rc { match value { - crate::operation::get_blob::GetBlobError::Unhandled(unhandled) => ::std::rc::Rc::new( - crate::r#simple::types::blob::internaldafny::types::Error::Opaque { - obj: ::dafny_runtime::upcast_object()( - ::dafny_runtime::object::new(unhandled), - ), - }, - ), - } + crate::operation::get_blob::GetBlobError::Unhandled(unhandled) => + ::std::rc::Rc::new(crate::r#simple::types::blob::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) + } } #[allow(dead_code)] diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_input.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_input.rs index 4e91b06d5..d37000fe2 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_input.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_input.rs @@ -1,42 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_blob::GetBlobInput, -) -> ::std::rc::Rc -{ - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&v, |x| *x), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +) -> ::std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::GetBlobInput, +>{ ::std::rc::Rc::new(crate::r#simple::types::blob::internaldafny::types::GetBlobInput::GetBlobInput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::oblob_to_dafny(&value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::blob::internaldafny::types::GetBlobInput, >, ) -> crate::operation::get_blob::GetBlobInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - ::std::rc::Rc::try_unwrap(dafny_value.value().Extract().to_array()) - .unwrap_or_else(|rc| (*rc).clone()), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - - crate::operation::get_blob::GetBlobInput { value } + crate::operation::get_blob::GetBlobInput::builder() + .set_value(crate::standard_library_conversions::oblob_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_output.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_output.rs index e9770da2c..a36a0e65c 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_output.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_output.rs @@ -1,43 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_blob::GetBlobOutput, -) -> ::std::rc::Rc -{ - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&b, |e| *e), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +) -> ::std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::GetBlobOutput, +>{ ::std::rc::Rc::new(crate::r#simple::types::blob::internaldafny::types::GetBlobOutput::GetBlobOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::oblob_to_dafny(&value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::blob::internaldafny::types::GetBlobOutput, >, ) -> crate::operation::get_blob::GetBlobOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec( - &dafny_value.value().Extract(), - |e| *e, - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_blob::GetBlobOutput { value } + crate::operation::get_blob::GetBlobOutput::builder() + .set_value(crate::standard_library_conversions::oblob_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value.rs deleted file mode 100644 index 50a67357d..000000000 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -use std::any::Any; - -#[allow(dead_code)] -pub fn to_dafny_error( - value: crate::operation::get_blob_known_value::GetBlobKnownValueError, -) -> ::std::rc::Rc { - match value { - crate::operation::get_blob_known_value::GetBlobKnownValueError::Unhandled(unhandled) => { - ::std::rc::Rc::new( - crate::r#simple::types::blob::internaldafny::types::Error::Opaque { - obj: ::dafny_runtime::upcast_object()( - ::dafny_runtime::object::new(unhandled), - ), - }, - ) - } - } -} - -#[allow(dead_code)] -pub fn from_dafny_error( - dafny_value: ::std::rc::Rc< - crate::r#simple::types::blob::internaldafny::types::Error, - >, -) -> crate::operation::get_blob_known_value::GetBlobKnownValueError { - // TODO: Losing information here, but we have to figure out how to wrap an arbitrary Dafny value as std::error::Error - if matches!(&dafny_value.as_ref(), crate::r#simple::types::blob::internaldafny::types::Error::CollectionOfErrors { .. }) { - let error_message = "TODO: can't get message yet"; - crate::operation::get_blob_known_value::GetBlobKnownValueError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) - } else { - crate::operation::get_blob_known_value::GetBlobKnownValueError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) - } -} - -pub mod _get_blob_known_value_input; - -pub mod _get_blob_known_value_output; diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_input.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_input.rs deleted file mode 100644 index 1e939e99a..000000000 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_input.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::get_blob_known_value::GetBlobKnownValueInput, -) -> ::std::rc::Rc -{ - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&v, |x| *x), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(crate::r#simple::types::blob::internaldafny::types::GetBlobInput::GetBlobInput { - value: ::std::rc::Rc::new(dafny_value) - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::types::blob::internaldafny::types::GetBlobInput, - >, -) -> crate::operation::get_blob_known_value::GetBlobKnownValueInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - ::std::rc::Rc::try_unwrap(dafny_value.value().Extract().to_array()) - .unwrap_or_else(|rc| (*rc).clone()), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_blob_known_value::GetBlobKnownValueInput { value } -} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_output.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_output.rs deleted file mode 100644 index 19cf63550..000000000 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_output.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::get_blob_known_value::GetBlobKnownValueOutput, -) -> ::std::rc::Rc -{ - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&v, |e| *e), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(crate::r#simple::types::blob::internaldafny::types::GetBlobOutput::GetBlobOutput { - value: ::std::rc::Rc::new(dafny_value) - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::types::blob::internaldafny::types::GetBlobOutput, - >, -) -> crate::operation::get_blob_known_value::GetBlobKnownValueOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec( - &dafny_value.value().Extract(), - |e| *e, - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_blob_known_value::GetBlobKnownValueOutput { value } -} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value_test.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value_test.rs new file mode 100644 index 000000000..7ff941094 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value_test.rs @@ -0,0 +1,33 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::any::Any; + +#[allow(dead_code)] +pub fn to_dafny_error( + value: crate::operation::get_blob_known_value_test::GetBlobKnownValueTestError, +) -> ::std::rc::Rc { + match value { + crate::operation::get_blob_known_value_test::GetBlobKnownValueTestError::Unhandled(unhandled) => + ::std::rc::Rc::new(crate::r#simple::types::blob::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) + } +} + +#[allow(dead_code)] +pub fn from_dafny_error( + dafny_value: ::std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::Error, + >, +) -> crate::operation::get_blob_known_value_test::GetBlobKnownValueTestError { + // TODO: Losing information here, but we have to figure out how to wrap an arbitrary Dafny value as std::error::Error + if matches!(&dafny_value.as_ref(), crate::r#simple::types::blob::internaldafny::types::Error::CollectionOfErrors { .. }) { + let error_message = "TODO: can't get message yet"; + crate::operation::get_blob_known_value_test::GetBlobKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) + } else { + crate::operation::get_blob_known_value_test::GetBlobKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) + } +} + +pub mod _get_blob_known_value_test_input; + +pub mod _get_blob_known_value_test_output; diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value_test/_get_blob_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value_test/_get_blob_known_value_test_input.rs new file mode 100644 index 000000000..49d2466ee --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value_test/_get_blob_known_value_test_input.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::get_blob_known_value_test::GetBlobInput, +) -> ::std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::GetBlobInput, +>{ + ::std::rc::Rc::new(crate::r#simple::types::blob::internaldafny::types::GetBlobInput::GetBlobInput { + value: crate::standard_library_conversions::oblob_to_dafny(&value.value), + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::GetBlobInput, + >, +) -> crate::operation::get_blob_known_value_test::GetBlobInput { + crate::operation::get_blob_known_value_test::GetBlobInput::builder() + .set_value(crate::standard_library_conversions::oblob_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() +} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value_test/_get_blob_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value_test/_get_blob_known_value_test_output.rs new file mode 100644 index 000000000..499929ee0 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value_test/_get_blob_known_value_test_output.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::get_blob_known_value_test::GetBlobOutput, +) -> ::std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::GetBlobOutput, +>{ + ::std::rc::Rc::new(crate::r#simple::types::blob::internaldafny::types::GetBlobOutput::GetBlobOutput { + value: crate::standard_library_conversions::oblob_to_dafny(&value.value), + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::GetBlobOutput, + >, +) -> crate::operation::get_blob_known_value_test::GetBlobOutput { + crate::operation::get_blob_known_value_test::GetBlobOutput::builder() + .set_value(crate::standard_library_conversions::oblob_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() +} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config.rs index 89599c3f8..7852c4ae1 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config.rs @@ -1,3 +1,4 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub mod _simple_blob_config; diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config/_simple_blob_config.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config/_simple_blob_config.rs index d0a4cd5c4..a9e1abdff 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config/_simple_blob_config.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config/_simple_blob_config.rs @@ -1,10 +1,13 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::types::simple_blob_config::SimpleBlobConfig, -) -> ::std::rc::Rc -{ +) -> ::std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::SimpleBlobConfig, +> { ::std::rc::Rc::new(crate::r#simple::types::blob::internaldafny::types::SimpleBlobConfig::SimpleBlobConfig {}) } diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error.rs index ec89cbecc..4cddaa7c3 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use ::aws_smithy_runtime_api::box_error::BoxError; /// Error type returned by the client. diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error/sealed_unhandled.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error/sealed_unhandled.rs index cce22d1cf..eae800729 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error/sealed_unhandled.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error/sealed_unhandled.rs @@ -1,4 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::any::Any; + +use dafny_runtime::UpcastObject; + /// This struct is not intended to be used. /// /// This struct holds information about an unhandled error, @@ -21,6 +27,6 @@ pub struct Unhandled { pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, } -impl ::dafny_runtime::UpcastObject for Unhandled { +impl UpcastObject for Unhandled { ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); } diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/lib.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/lib.rs deleted file mode 100644 index 3938142e1..000000000 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/lib.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![allow(deprecated)] - -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -pub mod client; -pub mod types; - -/// Common errors and error handling utilities. -pub mod error; - -/// All operations that this crate can perform. -pub mod operation; - -mod conversions; - -pub mod implementation_from_dafny; - -pub use client::Client; -pub use types::simple_blob_config::SimpleBlobConfig; diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation.rs index a72267eda..64ee269b5 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation.rs @@ -1,7 +1,8 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `GetBlob` operation. pub mod get_blob; -/// Types for the `GetBlobKnownValue` operation. -pub mod get_blob_known_value; +/// Types for the `GetBlobKnownValueTest` operation. +pub mod get_blob_known_value_test; diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob.rs index 2c923f1aa..037e8b83a 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetBlob`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -16,14 +18,17 @@ impl GetBlob { crate::operation::get_blob::GetBlobError, > { let inner_input = crate::conversions::get_blob::_get_blob_input::to_dafny(input); - let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()).GetBlob(&inner_input); + let inner_result = + ::dafny_runtime::md!(client.dafny_client.clone()).GetBlob(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } ) { - Ok(crate::conversions::get_blob::_get_blob_output::from_dafny( - inner_result.value().clone(), - )) + Ok( + crate::conversions::get_blob::_get_blob_output::from_dafny( + inner_result.value().clone(), + ), + ) } else { Err(crate::conversions::get_blob::from_dafny_error( inner_result.error().clone(), @@ -134,9 +139,9 @@ pub use crate::operation::get_blob::_get_blob_output::GetBlobOutput; pub use crate::operation::get_blob::_get_blob_input::GetBlobInput; -mod _get_blob_input; +pub(crate) mod _get_blob_output; -mod _get_blob_output; +pub(crate) mod _get_blob_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_input.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_input.rs index 6a0d554b1..335f1e1a3 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_input.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_input.rs @@ -1,16 +1,18 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetBlobInput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, +pub value: ::std::option::Option<::aws_smithy_types::Blob>, } impl GetBlobInput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&::std::vec::Vec<::std::primitive::u8>> { - self.value.as_ref() - } +pub fn value(&self) -> ::std::option::Option<::aws_smithy_types::Blob> { + self.value.clone() +} } impl GetBlobInput { /// Creates a new builder-style object to manufacture [`GetBlobInput`](crate::operation::operation::GetBlobInput). @@ -25,29 +27,23 @@ impl GetBlobInput { ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, )] pub struct GetBlobInputBuilder { - pub(crate) value: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, + pub(crate) value: ::std::option::Option<::aws_smithy_types::Blob>, } impl GetBlobInputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into<::std::vec::Vec<::std::primitive::u8>>, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> ::std::option::Option<&::std::vec::Vec<::std::primitive::u8>> { - self.value.as_ref() - } +pub fn value(mut self, input: impl ::std::convert::Into<::aws_smithy_types::Blob>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::aws_smithy_types::Blob> { + &self.value +} /// Consumes the builder and constructs a [`GetBlobInput`](crate::operation::operation::GetBlobInput). pub fn build( self, @@ -55,6 +51,8 @@ impl GetBlobInputBuilder { crate::operation::get_blob::GetBlobInput, ::aws_smithy_types::error::operation::BuildError, > { - ::std::result::Result::Ok(crate::operation::get_blob::GetBlobInput { value: self.value }) + ::std::result::Result::Ok(crate::operation::get_blob::GetBlobInput { + value: self.value, + }) } } diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_output.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_output.rs index b071eb836..7de15870c 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_output.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_output.rs @@ -1,19 +1,19 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetBlobOutput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, +pub value: ::std::option::Option<::aws_smithy_types::Blob>, } - impl GetBlobOutput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&::std::vec::Vec<::std::primitive::u8>> { - self.value.as_ref() - } +pub fn value(&self) -> ::std::option::Option<::aws_smithy_types::Blob> { + self.value.clone() +} } - impl GetBlobOutput { /// Creates a new builder-style object to manufacture [`GetBlobOutput`](crate::operation::operation::GetBlobOutput). pub fn builder() -> crate::operation::get_blob::builders::GetBlobOutputBuilder { @@ -27,33 +27,23 @@ impl GetBlobOutput { ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, )] pub struct GetBlobOutputBuilder { - pub(crate) value: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, + pub(crate) value: ::std::option::Option<::aws_smithy_types::Blob>, } - impl GetBlobOutputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into<::std::vec::Vec<::std::primitive::u8>>, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, - ) -> Self { - self.value = input; - self - } - - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> ::std::option::Option<&::std::vec::Vec<::std::primitive::u8>> { - self.value.as_ref() - } - +pub fn value(mut self, input: impl ::std::convert::Into<::aws_smithy_types::Blob>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::aws_smithy_types::Blob> { + &self.value +} /// Consumes the builder and constructs a [`GetBlobOutput`](crate::operation::operation::GetBlobOutput). pub fn build( self, @@ -61,6 +51,8 @@ impl GetBlobOutputBuilder { crate::operation::get_blob::GetBlobOutput, ::aws_smithy_types::error::operation::BuildError, > { - ::std::result::Result::Ok(crate::operation::get_blob::GetBlobOutput { value: self.value }) + ::std::result::Result::Ok(crate::operation::get_blob::GetBlobOutput { + value: self.value, + }) } } diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/builders.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/builders.rs index bedb57b10..7fd6ca61e 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/builders.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/builders.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use crate::operation::get_blob::_get_blob_output::GetBlobOutputBuilder; pub use crate::operation::get_blob::_get_blob_input::GetBlobInputBuilder; @@ -22,7 +24,7 @@ impl GetBlobInputBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetBlobFluentBuilder { client: crate::client::Client, - inner: crate::operation::get_blob::builders::GetBlobInputBuilder, + pub(crate) inner: crate::operation::get_blob::builders::GetBlobInputBuilder, } impl GetBlobFluentBuilder { /// Creates a new `GetBlob`. @@ -56,23 +58,17 @@ impl GetBlobFluentBuilder { } #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into<::std::vec::Vec<::std::primitive::u8>>, - ) -> Self { - self.inner = self.inner.value(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, - ) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> ::std::option::Option<&::std::vec::Vec<::std::primitive::u8>> { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into<::aws_smithy_types::Blob>) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::aws_smithy_types::Blob> { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_input.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_input.rs deleted file mode 100644 index be28c19c1..000000000 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_input.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetBlobKnownValueInput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, -} -impl GetBlobKnownValueInput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&::std::vec::Vec<::std::primitive::u8>> { - self.value.as_ref() - } -} -impl GetBlobKnownValueInput { - /// Creates a new builder-style object to manufacture [`GetBlobKnownValueInput`](crate::operation::operation::GetBlobKnownValueInput). - pub fn builder( - ) -> crate::operation::get_blob_known_value::builders::GetBlobKnownValueInputBuilder { - crate::operation::get_blob_known_value::builders::GetBlobKnownValueInputBuilder::default() - } -} - -/// A builder for [`GetBlobKnownValueInput`](crate::operation::operation::GetBlobKnownValueInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetBlobKnownValueInputBuilder { - pub(crate) value: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, -} -impl GetBlobKnownValueInputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into<::std::vec::Vec<::std::primitive::u8>>, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::vec::Vec<::std::primitive::u8>> { - &self.value - } - /// Consumes the builder and constructs a [`GetBlobKnownValueInput`](crate::operation::operation::GetBlobKnownValueInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_blob_known_value::GetBlobKnownValueInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_blob_known_value::GetBlobKnownValueInput { value: self.value }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_output.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_output.rs deleted file mode 100644 index 794b83ce4..000000000 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_output.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetBlobKnownValueOutput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, -} -impl GetBlobKnownValueOutput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&::std::vec::Vec<::std::primitive::u8>> { - self.value.as_ref() - } -} -impl GetBlobKnownValueOutput { - /// Creates a new builder-style object to manufacture [`GetBlobKnownValueOutput`](crate::operation::operation::GetBlobKnownValueOutput). - pub fn builder( - ) -> crate::operation::get_blob_known_value::builders::GetBlobKnownValueOutputBuilder { - crate::operation::get_blob_known_value::builders::GetBlobKnownValueOutputBuilder::default() - } -} - -/// A builder for [`GetBlobKnownValueOutput`](crate::operation::operation::GetBlobKnownValueOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetBlobKnownValueOutputBuilder { - pub(crate) value: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, -} -impl GetBlobKnownValueOutputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into<::std::vec::Vec<::std::primitive::u8>>, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::vec::Vec<::std::primitive::u8>> { - &self.value - } - /// Consumes the builder and constructs a [`GetBlobKnownValueOutput`](crate::operation::operation::GetBlobKnownValueOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_blob_known_value::GetBlobKnownValueOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_blob_known_value::GetBlobKnownValueOutput { value: self.value }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/builders.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/builders.rs deleted file mode 100644 index 274bb3f37..000000000 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/builders.rs +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_blob_known_value::_get_blob_known_value_output::GetBlobKnownValueOutputBuilder; - -pub use crate::operation::get_blob_known_value::_get_blob_known_value_input::GetBlobKnownValueInputBuilder; - -impl GetBlobKnownValueInputBuilder { - /// Sends a request with this input using the given client. - pub async fn send_with( - self, - client: &crate::Client, - ) -> ::std::result::Result< - crate::operation::get_blob_known_value::GetBlobKnownValueOutput, - crate::operation::get_blob_known_value::GetBlobKnownValueError, - > { - let mut fluent_builder = client.get_blob_known_value(); - fluent_builder.inner = self; - fluent_builder.send().await - } -} -/// Fluent builder constructing a request to `GetBlobKnownValue`. -/// -#[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct GetBlobKnownValueFluentBuilder { - client: crate::client::Client, - inner: crate::operation::get_blob_known_value::builders::GetBlobKnownValueInputBuilder, -} -impl GetBlobKnownValueFluentBuilder { - /// Creates a new `GetBlobKnownValue`. - pub(crate) fn new(client: crate::client::Client) -> Self { - Self { - client, - inner: ::std::default::Default::default(), - } - } - /// Access the GetBlobKnownValue as a reference. - pub fn as_input( - &self, - ) -> &crate::operation::get_blob_known_value::builders::GetBlobKnownValueInputBuilder { - &self.inner - } - /// Sends the request and returns the response. - pub async fn send( - self, - ) -> ::std::result::Result< - crate::operation::get_blob_known_value::GetBlobKnownValueOutput, - crate::operation::get_blob_known_value::GetBlobKnownValueError, - > { - let input = self - .inner - .build() - // Using unhandled since GetBlob doesn't declare any validation, - // and smithy-rs seems to not generate a ValidationError case unless there is - // (but isn't that a backwards compatibility problem for output structures?) - // Vanilla smithy-rs uses SdkError::construction_failure, - // but we aren't using SdkError. - .map_err(crate::operation::get_blob_known_value::GetBlobKnownValueError::unhandled)?; - crate::operation::get_blob_known_value::GetBlobKnownValue::send(&self.client, input).await - } - - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into<::std::vec::Vec<::std::primitive::u8>>, - ) -> Self { - self.inner = self.inner.value(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, - ) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::vec::Vec<::std::primitive::u8>> { - self.inner.get_value() - } -} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test.rs similarity index 67% rename from TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value.rs rename to TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test.rs index ee1819d4f..32709dd75 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test.rs @@ -1,44 +1,46 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -/// Orchestration and serialization glue logic for `GetBlobKnownValue`. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +/// Orchestration and serialization glue logic for `GetBlobKnownValueTest`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] -pub struct GetBlobKnownValue; -impl GetBlobKnownValue { - /// Creates a new `GetBlobKnownValue` +pub struct GetBlobKnownValueTest; +impl GetBlobKnownValueTest { + /// Creates a new `GetBlobKnownValueTest` pub fn new() -> Self { Self } pub(crate) async fn send( client: &crate::client::Client, - input: crate::operation::get_blob_known_value::GetBlobKnownValueInput, + input: crate::operation::get_blob_known_value_test::GetBlobInput, ) -> ::std::result::Result< - crate::operation::get_blob_known_value::GetBlobKnownValueOutput, - crate::operation::get_blob_known_value::GetBlobKnownValueError, + crate::operation::get_blob_known_value_test::GetBlobOutput, + crate::operation::get_blob_known_value_test::GetBlobKnownValueTestError, > { - let inner_input = - crate::conversions::get_blob_known_value::_get_blob_known_value_input::to_dafny(input); - let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()).GetBlob(&inner_input); + let inner_input = crate::conversions::get_blob_known_value_test::_get_blob_known_value_test_input::to_dafny(input); + let inner_result = + ::dafny_runtime::md!(client.dafny_client.clone()).GetBlobKnownValueTest(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } ) { Ok( - crate::conversions::get_blob_known_value::_get_blob_known_value_output::from_dafny( + crate::conversions::get_blob_known_value_test::_get_blob_known_value_test_output::from_dafny( inner_result.value().clone(), ), ) } else { - Err(crate::conversions::get_blob_known_value::from_dafny_error( + Err(crate::conversions::get_blob_known_value_test::from_dafny_error( inner_result.error().clone(), )) } } } -/// Error type for the `GetBlobKnownValue` operation. +/// Error type for the `GetBlobKnownValueTest` operation. #[non_exhaustive] #[derive(::std::fmt::Debug)] -pub enum GetBlobKnownValueError { +pub enum GetBlobKnownValueTestError { /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). #[deprecated( note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ @@ -46,12 +48,12 @@ pub enum GetBlobKnownValueError { \    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` \ - See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetBlobKnownValueError) for what information is available for the error." + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetBlobKnownValueTestError) for what information is available for the error." )] Unhandled(crate::error::sealed_unhandled::Unhandled), } -impl GetBlobKnownValueError { - /// Creates the `GetBlobKnownValueError::Unhandled` variant from any error type. +impl GetBlobKnownValueTestError { + /// Creates the `GetBlobKnownValueTestError::Unhandled` variant from any error type. pub fn unhandled( err: impl ::std::convert::Into< ::std::boxed::Box< @@ -65,7 +67,7 @@ impl GetBlobKnownValueError { }) } - /// Creates the `GetBlobKnownValueError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + /// Creates the `GetBlobKnownValueTestError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), @@ -82,14 +84,14 @@ impl GetBlobKnownValueError { } } } -impl ::std::error::Error for GetBlobKnownValueError { +impl ::std::error::Error for GetBlobKnownValueTestError { fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { match self { Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source), } } } -impl ::std::fmt::Display for GetBlobKnownValueError { +impl ::std::fmt::Display for GetBlobKnownValueTestError { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match self { Self::Unhandled(_inner) => { @@ -104,7 +106,7 @@ impl ::std::fmt::Display for GetBlobKnownValueError { } } } -impl ::aws_smithy_types::retry::ProvideErrorKind for GetBlobKnownValueError { +impl ::aws_smithy_types::retry::ProvideErrorKind for GetBlobKnownValueTestError { fn code(&self) -> ::std::option::Option<&str> { ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) } @@ -112,14 +114,14 @@ impl ::aws_smithy_types::retry::ProvideErrorKind for GetBlobKnownValueError { ::std::option::Option::None } } -impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetBlobKnownValueError { +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetBlobKnownValueTestError { fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { match self { Self::Unhandled(_inner) => &_inner.meta, } } } -impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetBlobKnownValueError { +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetBlobKnownValueTestError { fn create_unhandled_error( source: ::std::boxed::Box< dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, @@ -133,13 +135,13 @@ impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetBlobK } } -pub use crate::operation::get_blob_known_value::_get_blob_known_value_output::GetBlobKnownValueOutput; +pub use crate::operation::get_blob_known_value_test::_get_blob_output::GetBlobOutput; -pub use crate::operation::get_blob_known_value::_get_blob_known_value_input::GetBlobKnownValueInput; +pub use crate::operation::get_blob_known_value_test::_get_blob_input::GetBlobInput; -mod _get_blob_known_value_input; +pub(crate) mod _get_blob_output; -mod _get_blob_known_value_output; +pub(crate) mod _get_blob_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test/_get_blob_input.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test/_get_blob_input.rs new file mode 100644 index 000000000..9eb9a55b9 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test/_get_blob_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetBlobInput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option<::aws_smithy_types::Blob>, +} +impl GetBlobInput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option<::aws_smithy_types::Blob> { + self.value.clone() +} +} +impl GetBlobInput { + /// Creates a new builder-style object to manufacture [`GetBlobInput`](crate::operation::operation::GetBlobInput). + pub fn builder() -> crate::operation::get_blob_known_value_test::builders::GetBlobInputBuilder { + crate::operation::get_blob_known_value_test::builders::GetBlobInputBuilder::default() + } +} + +/// A builder for [`GetBlobInput`](crate::operation::operation::GetBlobInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetBlobInputBuilder { + pub(crate) value: ::std::option::Option<::aws_smithy_types::Blob>, +} +impl GetBlobInputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::aws_smithy_types::Blob>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::aws_smithy_types::Blob> { + &self.value +} + /// Consumes the builder and constructs a [`GetBlobInput`](crate::operation::operation::GetBlobInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_blob_known_value_test::GetBlobInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_blob_known_value_test::GetBlobInput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test/_get_blob_output.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test/_get_blob_output.rs new file mode 100644 index 000000000..81cb83d89 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test/_get_blob_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetBlobOutput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option<::aws_smithy_types::Blob>, +} +impl GetBlobOutput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option<::aws_smithy_types::Blob> { + self.value.clone() +} +} +impl GetBlobOutput { + /// Creates a new builder-style object to manufacture [`GetBlobOutput`](crate::operation::operation::GetBlobOutput). + pub fn builder() -> crate::operation::get_blob_known_value_test::builders::GetBlobOutputBuilder { + crate::operation::get_blob_known_value_test::builders::GetBlobOutputBuilder::default() + } +} + +/// A builder for [`GetBlobOutput`](crate::operation::operation::GetBlobOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetBlobOutputBuilder { + pub(crate) value: ::std::option::Option<::aws_smithy_types::Blob>, +} +impl GetBlobOutputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::aws_smithy_types::Blob>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::aws_smithy_types::Blob> { + &self.value +} + /// Consumes the builder and constructs a [`GetBlobOutput`](crate::operation::operation::GetBlobOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_blob_known_value_test::GetBlobOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_blob_known_value_test::GetBlobOutput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test/builders.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test/builders.rs new file mode 100644 index 000000000..b7ef06d06 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value_test/builders.rs @@ -0,0 +1,74 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::get_blob_known_value_test::_get_blob_output::GetBlobOutputBuilder; + +pub use crate::operation::get_blob_known_value_test::_get_blob_input::GetBlobInputBuilder; + +impl GetBlobInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with( + self, + client: &crate::Client, + ) -> ::std::result::Result< + crate::operation::get_blob_known_value_test::GetBlobOutput, + crate::operation::get_blob_known_value_test::GetBlobKnownValueTestError, + > { + let mut fluent_builder = client.get_blob_known_value_test(); + fluent_builder.inner = self; + fluent_builder.send().await + } +} +/// Fluent builder constructing a request to `GetBlobKnownValueTest`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct GetBlobKnownValueTestFluentBuilder { + client: crate::client::Client, + pub(crate) inner: crate::operation::get_blob_known_value_test::builders::GetBlobInputBuilder, +} +impl GetBlobKnownValueTestFluentBuilder { + /// Creates a new `GetBlobKnownValueTest`. + pub(crate) fn new(client: crate::client::Client) -> Self { + Self { + client, + inner: ::std::default::Default::default(), + } + } + /// Access the GetBlobKnownValueTest as a reference. + pub fn as_input(&self) -> &crate::operation::get_blob_known_value_test::builders::GetBlobInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + pub async fn send( + self, + ) -> ::std::result::Result< + crate::operation::get_blob_known_value_test::GetBlobOutput, + crate::operation::get_blob_known_value_test::GetBlobKnownValueTestError, + > { + let input = self + .inner + .build() + // Using unhandled since GetBlobKnownValueTest doesn't declare any validation, + // and smithy-rs seems to not generate a ValidationError case unless there is + // (but isn't that a backwards compatibility problem for output structures?) + // Vanilla smithy-rs uses SdkError::construction_failure, + // but we aren't using SdkError. + .map_err(crate::operation::get_blob_known_value_test::GetBlobKnownValueTestError::unhandled)?; + crate::operation::get_blob_known_value_test::GetBlobKnownValueTest::send(&self.client, input).await + } + + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::aws_smithy_types::Blob>) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::aws_smithy_types::Blob> { + self.inner.get_value() +} +} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/standard_library_conversions.rs index 3a51134c6..6bf8297d8 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/standard_library_conversions.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/standard_library_conversions.rs @@ -1,246 +1,266 @@ pub fn ostring_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, > { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) - }, - None => crate::_Wrappers_Compile::Option::None {}, + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) + }, + None => crate::_Wrappers_Compile::Option::None {}, }; - ::std::rc::Rc::new(dafny_value) + ::std::rc::Rc::new(dafny_value) } pub fn ostring_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, - >, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input.Extract(), - ), - ) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some( + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input.Extract(), + ), + ) + } else { + None + } } -pub fn obool_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn obool_to_dafny( + input: &Option, +) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn obool_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn obool_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn olong_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn olong_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn olong_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn blob_to_dafny( - input: &::aws_smithy_types::Blob, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) +pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) } pub fn oblob_to_dafny( - input: &Option<::aws_smithy_types::Blob>, + input: &Option<::aws_smithy_types::Blob>, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: blob_to_dafny(&b), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { + value: blob_to_dafny(&b), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn blob_from_dafny( - input: ::dafny_runtime::Sequence, -) -> ::aws_smithy_types::Blob { - - ::aws_smithy_types::Blob::new( - ::std::rc::Rc::try_unwrap(input.to_array()) - .unwrap_or_else(|rc| (*rc).clone()), - ) +pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { + ::aws_smithy_types::Blob::new( + ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), + ) } pub fn oblob_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option<::aws_smithy_types::Blob> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(blob_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(blob_from_dafny(input.Extract())) + } else { + None + } } -pub fn double_to_dafny( - input: f64, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( - &f64::to_be_bytes(input).to_vec(), - |x| *x) +pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( + &f64::to_be_bytes(input).to_vec(), + |x| *x, + ) } pub fn odouble_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: double_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: double_to_dafny(*f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn double_from_dafny( - input: &::dafny_runtime::Sequence, -) -> f64 { - let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); - f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) +pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { + let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); + f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) } pub fn odouble_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(double_from_dafny(&input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(double_from_dafny(&input.Extract())) + } else { + None + } } pub fn timestamp_to_dafny( - input: ::aws_smithy_types::DateTime, + input: &::aws_smithy_types::DateTime, ) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&input.to_string()) + ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &input.to_string(), + ) } pub fn otimestamp_to_dafny( - input: &Option<::aws_smithy_types::DateTime>, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: timestamp_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + input: &Option<::aws_smithy_types::DateTime>, +) -> ::std::rc::Rc< + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, +> { + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: timestamp_to_dafny(f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn timestamp_from_dafny( - input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, ) -> ::aws_smithy_types::DateTime { - let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&input); - ::aws_smithy_types::DateTime::from_str( - &s, - aws_smithy_types::date_time::Format::DateTime, - ).unwrap() + let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input, + ); + ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) + .unwrap() } pub fn otimestamp_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option<::aws_smithy_types::DateTime> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(timestamp_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(timestamp_from_dafny(input.Extract())) + } else { + None + } } pub fn option_from_dafny( - input: ::std::rc::Rc>, - converter: fn(&T) -> TR, + input: ::std::rc::Rc>, + converter: fn(&T) -> TR, ) -> Option { - match &*input { - crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), - crate::_Wrappers_Compile::Option::None { } => None, - } + match &*input { + crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), + crate::_Wrappers_Compile::Option::None {} => None, + } } pub fn option_to_dafny( - input: &Option, - converter: fn(&TR) -> T, + input: &Option, + converter: fn(&TR) -> T, ) -> ::std::rc::Rc> { - match input { - Some(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::Some { - value: converter(&value) - } - ), - None => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::None {} - ), - } + match input { + Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { + value: converter(&value), + }), + None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), + } } pub fn result_from_dafny( - input: ::std::rc::Rc>, - converter_t: fn(&T) -> TR, - converter_e: fn(&E) -> ER, + input: ::std::rc::Rc>, + converter_t: fn(&T) -> TR, + converter_e: fn(&E) -> ER, ) -> Result { - match &*input { - crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), - crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), - } + match &*input { + crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), + crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), + } } pub fn result_to_dafny( - input: &Result, - converter_t: fn(&TR) -> T, - converter_e: fn(&ER) -> E, + input: &Result, + converter_t: fn(&TR) -> T, + converter_e: fn(&ER) -> E, ) -> ::std::rc::Rc> { - match input { - Ok(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: converter_t(&value) - } - ), - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: converter_e(&error) - } - ), - } -} \ No newline at end of file + match input { + Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { + value: converter_t(&value), + }), + Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { + error: converter_e(&error), + }), + } +} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/standard_library_externs.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types.rs index 1dca219a0..ce57ffa44 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types.rs @@ -1,4 +1,5 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `SimpleBlobConfig` pub mod simple_blob_config; diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types/simple_blob_config.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types/simple_blob_config.rs index 0709ccb7e..8386df973 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types/simple_blob_config.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types/simple_blob_config.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct SimpleBlobConfig {} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/wrapped.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/wrapped.rs new file mode 100644 index 000000000..5c03253bf --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/wrapped.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod client; + +impl crate::r#simple::types::blob::internaldafny::wrapped::_default { + pub fn WrappedSimpleBlob(config: &::std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::SimpleBlobConfig, + >) -> ::std::rc::Rc, + ::std::rc::Rc + >>{ + crate::wrapped::client::Client::from_conf(config) + } +} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/wrapped/client.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/wrapped/client.rs new file mode 100644 index 000000000..1cfbbbb81 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/wrapped/client.rs @@ -0,0 +1,119 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use tokio::runtime::Runtime; + +pub struct Client { + wrapped: crate::client::Client, + + /// A `current_thread` runtime for executing operations on the + /// asynchronous client in a blocking manner. + rt: Runtime +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn crate::r#simple::types::blob::internaldafny::types::ISimpleTypesBlobClient); +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); +} + +impl Client { + pub fn from_conf(config: &::std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::SimpleBlobConfig, + >) -> +::std::rc::Rc, + ::std::rc::Rc +>> { + let rt_result = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build(); + let rt = match rt_result { + Ok(x) => x, + Err(error) => return crate::conversions::error::to_opaque_error_result(error), + }; + let result = crate::client::Client::from_conf( + crate::conversions::simple_blob_config::_simple_blob_config::from_dafny( + config.clone(), + ), + ); + match result { + Ok(client) => { + let wrap = crate::wrapped::client::Client { + wrapped: client, + rt + }; + std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(wrap)) + } + ) + }, + Err(error) => crate::conversions::error::to_opaque_error_result(error) + } + } +} + +impl crate::r#simple::types::blob::internaldafny::types::ISimpleTypesBlobClient for Client { + fn GetBlob( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::GetBlobInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::GetBlobOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_blob::_get_blob_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_blob::GetBlob::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_blob::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_blob::_get_blob_output::to_dafny(client), + }, + ), + } + } + + fn GetBlobKnownValueTest( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::GetBlobInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::blob::internaldafny::types::GetBlobOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_blob_known_value_test::_get_blob_known_value_test_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_blob_known_value_test::GetBlobKnownValueTest::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_blob_known_value_test::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_blob_known_value_test::_get_blob_known_value_test_output::to_dafny(client), + }, + ), + } + } +} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/tests/simple_blob_test.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/tests/simple_blob_test.rs index bf6ce9675..b9c9ed997 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/tests/simple_blob_test.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/tests/simple_blob_test.rs @@ -32,11 +32,11 @@ use simple_blob::*; */ #[tokio::test] async fn test_get_blob() { - let s = vec![0x0, 0x1, 0x2]; + let s = aws_smithy_types::Blob::new(vec![0x0, 0x1, 0x2]); let result = client().get_blob().value(s.clone()).send().await; let output = result.unwrap(); let value = output.value().unwrap(); - assert_eq!(value, &s); + assert_eq!(value, s); } /* @@ -64,15 +64,15 @@ async fn test_get_blob() { #[tokio::test] async fn test_get_known_value() { - let s = vec![0x0, 0x2, 0x4]; + let s = aws_smithy_types::Blob::new(vec![0x0, 0x2, 0x4]); let result = client() - .get_blob_known_value() + .get_blob_known_value_test() .value(s.clone()) .send() .await; let output = result.unwrap(); let value = output.value().unwrap(); - assert_eq!(value, &s); + assert_eq!(value, s); } pub fn client() -> Client { diff --git a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/standard_library_externs.rs b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/SimpleTypes/SimpleDouble/Makefile b/TestModels/SimpleTypes/SimpleDouble/Makefile index 75eec0f36..722e7e541 100644 --- a/TestModels/SimpleTypes/SimpleDouble/Makefile +++ b/TestModels/SimpleTypes/SimpleDouble/Makefile @@ -3,8 +3,9 @@ CORES=2 +TRANSPILE_TESTS_IN_RUST=1 + ENABLE_EXTERN_PROCESSING=1 -RUST_BENERATED=1 include ../../SharedMakefile.mk diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/Cargo.toml b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/Cargo.toml index 3bb72ebe2..0135a1e23 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/Cargo.toml +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/Cargo.toml @@ -5,13 +5,19 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +wrapped-client = [] + [dependencies] aws-smithy-runtime = {version = "1.6.0", features = ["client"] } aws-smithy-runtime-api = {version = "1.7.0", features = ["client"] } aws-smithy-types = "1.2.0" dafny_runtime = { path = "../../../../dafny-dependencies/dafny_runtime_rust"} -[dev-dependencies.tokio] +[dev-dependencies] +simple_double = { path = ".", features = ["wrapped-client"] } + +[dependencies.tokio] version = "1.26.0" features = ["full"] diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client.rs index 582708346..a85858031 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use aws_smithy_types::error::operation::BuildError; #[derive(::std::clone::Clone, ::std::fmt::Debug)] @@ -29,7 +30,7 @@ impl Client { )); } Ok(Self { - dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), + dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) }) } } diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client/get_double.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client/get_double.rs index db3ce635e..a41fdf754 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client/get_double.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client/get_double.rs @@ -1,11 +1,13 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { /// Constructs a fluent builder for the [`GetDouble`](crate::operation::get_double::builders::GetDoubleFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(f64)`](crate::operation::get_double::builders::GetDoubleFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_double::builders::GetDoubleFluentBuilder::set_value):(undocumented)
+ /// - [`value(impl Into>)`](crate::operation::get_double::builders::GetDoubleFluentBuilder::value) / [`set_value(Option<::std::primitive::f64>)`](crate::operation::get_double::builders::GetDoubleFluentBuilder::set_value): (undocumented)
/// - On success, responds with [`GetDoubleOutput`](crate::operation::get_double::GetDoubleOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_double::GetDoubleOutput::value): (undocumented) + /// - [`value(Option<::std::primitive::f64>)`](crate::operation::get_double::GetDoubleOutput::value): (undocumented) /// - On failure, responds with [`SdkError`](crate::operation::get_double::GetDoubleError) pub fn get_double(&self) -> crate::operation::get_double::builders::GetDoubleFluentBuilder { crate::operation::get_double::builders::GetDoubleFluentBuilder::new(self.clone()) diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions.rs index 08430ee33..f861ad174 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions.rs @@ -1,4 +1,8 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub mod get_double; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod error; -pub mod simple_double_config; + pub mod get_double; + + pub mod simple_double_config; diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/error.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/error.rs new file mode 100644 index 000000000..1003d3aed --- /dev/null +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/error.rs @@ -0,0 +1,32 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + /// Wraps up an arbitrary Rust Error value as a Dafny Error +pub fn to_opaque_error(value: E) -> + ::std::rc::Rc +{ + let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( + ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), + )); + ::std::rc::Rc::new( + crate::r#simple::types::smithydouble::internaldafny::types::Error::Opaque { + obj: error_obj, + }, + ) +} + +/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure +pub fn to_opaque_error_result(value: E) -> + ::std::rc::Rc< + crate::_Wrappers_Compile::Result< + T, + ::std::rc::Rc + > + > +{ + ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: to_opaque_error(value), + }, + ) +} diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double.rs index 45f3afc17..e886c559a 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double.rs @@ -1,12 +1,12 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] pub fn to_dafny_error( value: crate::operation::get_double::GetDoubleError, -) -> ::std::rc::Rc -{ +) -> ::std::rc::Rc { match value { crate::operation::get_double::GetDoubleError::Unhandled(unhandled) => ::std::rc::Rc::new(crate::r#simple::types::smithydouble::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_input.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_input.rs index 1a6a82f8e..a0b658835 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_input.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_input.rs @@ -1,47 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_double::GetDoubleInput, ) -> ::std::rc::Rc< crate::r#simple::types::smithydouble::internaldafny::types::GetDoubleInput, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: ::dafny_runtime::Sequence::ArraySequence { - values: std::rc::Rc::new(f64::to_be_bytes(v).to_vec()), - }, - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithydouble::internaldafny::types::GetDoubleInput::GetDoubleInput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::odouble_to_dafny(&value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithydouble::internaldafny::types::GetDoubleInput, >, ) -> crate::operation::get_double::GetDoubleInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - let my_vec = dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec( - &dafny_value.value().Extract(), - |x| *x, - ); - Some(f64::from_be_bytes( - my_vec.try_into().expect("Error converting Sequence to f64"), - )) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_double::GetDoubleInput { value } + crate::operation::get_double::GetDoubleInput::builder() + .set_value(crate::standard_library_conversions::odouble_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_output.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_output.rs index 5dcd0eb48..6607d6788 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_output.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_output.rs @@ -1,47 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_double::GetDoubleOutput, ) -> ::std::rc::Rc< crate::r#simple::types::smithydouble::internaldafny::types::GetDoubleOutput, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: ::dafny_runtime::Sequence::ArraySequence { - values: std::rc::Rc::new(f64::to_be_bytes(v).to_vec()), - }, - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithydouble::internaldafny::types::GetDoubleOutput::GetDoubleOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::odouble_to_dafny(&value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithydouble::internaldafny::types::GetDoubleOutput, >, ) -> crate::operation::get_double::GetDoubleOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - let my_vec = dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec( - &dafny_value.value().Extract(), - |x| *x, - ); - Some(f64::from_be_bytes( - my_vec.try_into().expect("Error converting Sequence to f64"), - )) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_double::GetDoubleOutput { value } + crate::operation::get_double::GetDoubleOutput::builder() + .set_value(crate::standard_library_conversions::odouble_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config.rs index 52a68a7b0..4289c31fa 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config.rs @@ -1,3 +1,4 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub mod _simple_double_config; diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config/_simple_double_config.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config/_simple_double_config.rs index f726f08b6..4dd5aa6c0 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config/_simple_double_config.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config/_simple_double_config.rs @@ -1,10 +1,12 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::types::simple_double_config::SimpleDoubleConfig, ) -> ::std::rc::Rc< - crate::simple::types::smithydouble::internaldafny::types::SimpleDoubleConfig, + crate::r#simple::types::smithydouble::internaldafny::types::SimpleDoubleConfig, > { ::std::rc::Rc::new(crate::r#simple::types::smithydouble::internaldafny::types::SimpleDoubleConfig::SimpleDoubleConfig {}) } diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error.rs index ec89cbecc..4cddaa7c3 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use ::aws_smithy_runtime_api::box_error::BoxError; /// Error type returned by the client. diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error/sealed_unhandled.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error/sealed_unhandled.rs index cce22d1cf..eae800729 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error/sealed_unhandled.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error/sealed_unhandled.rs @@ -1,4 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::any::Any; + +use dafny_runtime::UpcastObject; + /// This struct is not intended to be used. /// /// This struct holds information about an unhandled error, @@ -21,6 +27,6 @@ pub struct Unhandled { pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, } -impl ::dafny_runtime::UpcastObject for Unhandled { +impl UpcastObject for Unhandled { ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); } diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/lib.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/lib.rs deleted file mode 100644 index 94379fc04..000000000 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/lib.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![allow(deprecated)] - -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -pub mod client; -pub mod types; - -/// Common errors and error handling utilities. -pub mod error; - -/// All operations that this crate can perform. -pub mod operation; - -mod conversions; - -pub mod implementation_from_dafny; - -pub use client::Client; -pub use types::simple_double_config::SimpleDoubleConfig; diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation.rs index 134175f81..3b489e6c9 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation.rs @@ -1,4 +1,5 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `GetDouble` operation. pub mod get_double; diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double.rs index 8b6d980d9..38c65eb84 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetDouble`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -137,9 +139,9 @@ pub use crate::operation::get_double::_get_double_output::GetDoubleOutput; pub use crate::operation::get_double::_get_double_input::GetDoubleInput; -mod _get_double_input; +pub(crate) mod _get_double_output; -mod _get_double_output; +pub(crate) mod _get_double_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_input.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_input.rs index af1cc4102..598b2c0b0 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_input.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_input.rs @@ -1,16 +1,18 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetDoubleInput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, +pub value: ::std::option::Option<::std::primitive::f64>, } impl GetDoubleInput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&f64> { - self.value.as_ref() - } +pub fn value(&self) -> ::std::option::Option<::std::primitive::f64> { + self.value +} } impl GetDoubleInput { /// Creates a new builder-style object to manufacture [`GetDoubleInput`](crate::operation::operation::GetDoubleInput). @@ -25,23 +27,23 @@ impl GetDoubleInput { ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, )] pub struct GetDoubleInputBuilder { - pub(crate) value: ::std::option::Option, + pub(crate) value: ::std::option::Option<::std::primitive::f64>, } impl GetDoubleInputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - &self.value - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::f64>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::f64>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::f64> { + &self.value +} /// Consumes the builder and constructs a [`GetDoubleInput`](crate::operation::operation::GetDoubleInput). pub fn build( self, diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_output.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_output.rs index bf850acd3..20305255c 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_output.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_output.rs @@ -1,19 +1,19 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetDoubleOutput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, +pub value: ::std::option::Option<::std::primitive::f64>, } - impl GetDoubleOutput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } +pub fn value(&self) -> ::std::option::Option<::std::primitive::f64> { + self.value +} } - impl GetDoubleOutput { /// Creates a new builder-style object to manufacture [`GetDoubleOutput`](crate::operation::operation::GetDoubleOutput). pub fn builder() -> crate::operation::get_double::builders::GetDoubleOutputBuilder { @@ -27,27 +27,23 @@ impl GetDoubleOutput { ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, )] pub struct GetDoubleOutputBuilder { - pub(crate) value: ::std::option::Option, + pub(crate) value: ::std::option::Option<::std::primitive::f64>, } - impl GetDoubleOutputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.value = input; - self - } - - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - &self.value - } - +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::f64>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::f64>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::f64> { + &self.value +} /// Consumes the builder and constructs a [`GetDoubleOutput`](crate::operation::operation::GetDoubleOutput). pub fn build( self, diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/builders.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/builders.rs index ed9fd9a40..dd6f7e015 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/builders.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/builders.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use crate::operation::get_double::_get_double_output::GetDoubleOutputBuilder; pub use crate::operation::get_double::_get_double_input::GetDoubleInputBuilder; @@ -22,7 +24,7 @@ impl GetDoubleInputBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetDoubleFluentBuilder { client: crate::client::Client, - inner: crate::operation::get_double::builders::GetDoubleInputBuilder, + pub(crate) inner: crate::operation::get_double::builders::GetDoubleInputBuilder, } impl GetDoubleFluentBuilder { /// Creates a new `GetDouble`. @@ -56,17 +58,17 @@ impl GetDoubleFluentBuilder { } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: f64) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::f64>) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::f64>) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::f64> { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/standard_library_conversions.rs index 3a51134c6..6bf8297d8 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/standard_library_conversions.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/standard_library_conversions.rs @@ -1,246 +1,266 @@ pub fn ostring_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, > { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) - }, - None => crate::_Wrappers_Compile::Option::None {}, + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) + }, + None => crate::_Wrappers_Compile::Option::None {}, }; - ::std::rc::Rc::new(dafny_value) + ::std::rc::Rc::new(dafny_value) } pub fn ostring_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, - >, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input.Extract(), - ), - ) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some( + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input.Extract(), + ), + ) + } else { + None + } } -pub fn obool_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn obool_to_dafny( + input: &Option, +) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn obool_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn obool_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn olong_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn olong_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn olong_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn blob_to_dafny( - input: &::aws_smithy_types::Blob, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) +pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) } pub fn oblob_to_dafny( - input: &Option<::aws_smithy_types::Blob>, + input: &Option<::aws_smithy_types::Blob>, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: blob_to_dafny(&b), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { + value: blob_to_dafny(&b), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn blob_from_dafny( - input: ::dafny_runtime::Sequence, -) -> ::aws_smithy_types::Blob { - - ::aws_smithy_types::Blob::new( - ::std::rc::Rc::try_unwrap(input.to_array()) - .unwrap_or_else(|rc| (*rc).clone()), - ) +pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { + ::aws_smithy_types::Blob::new( + ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), + ) } pub fn oblob_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option<::aws_smithy_types::Blob> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(blob_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(blob_from_dafny(input.Extract())) + } else { + None + } } -pub fn double_to_dafny( - input: f64, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( - &f64::to_be_bytes(input).to_vec(), - |x| *x) +pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( + &f64::to_be_bytes(input).to_vec(), + |x| *x, + ) } pub fn odouble_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: double_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: double_to_dafny(*f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn double_from_dafny( - input: &::dafny_runtime::Sequence, -) -> f64 { - let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); - f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) +pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { + let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); + f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) } pub fn odouble_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(double_from_dafny(&input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(double_from_dafny(&input.Extract())) + } else { + None + } } pub fn timestamp_to_dafny( - input: ::aws_smithy_types::DateTime, + input: &::aws_smithy_types::DateTime, ) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&input.to_string()) + ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &input.to_string(), + ) } pub fn otimestamp_to_dafny( - input: &Option<::aws_smithy_types::DateTime>, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: timestamp_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + input: &Option<::aws_smithy_types::DateTime>, +) -> ::std::rc::Rc< + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, +> { + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: timestamp_to_dafny(f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn timestamp_from_dafny( - input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, ) -> ::aws_smithy_types::DateTime { - let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&input); - ::aws_smithy_types::DateTime::from_str( - &s, - aws_smithy_types::date_time::Format::DateTime, - ).unwrap() + let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input, + ); + ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) + .unwrap() } pub fn otimestamp_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option<::aws_smithy_types::DateTime> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(timestamp_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(timestamp_from_dafny(input.Extract())) + } else { + None + } } pub fn option_from_dafny( - input: ::std::rc::Rc>, - converter: fn(&T) -> TR, + input: ::std::rc::Rc>, + converter: fn(&T) -> TR, ) -> Option { - match &*input { - crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), - crate::_Wrappers_Compile::Option::None { } => None, - } + match &*input { + crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), + crate::_Wrappers_Compile::Option::None {} => None, + } } pub fn option_to_dafny( - input: &Option, - converter: fn(&TR) -> T, + input: &Option, + converter: fn(&TR) -> T, ) -> ::std::rc::Rc> { - match input { - Some(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::Some { - value: converter(&value) - } - ), - None => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::None {} - ), - } + match input { + Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { + value: converter(&value), + }), + None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), + } } pub fn result_from_dafny( - input: ::std::rc::Rc>, - converter_t: fn(&T) -> TR, - converter_e: fn(&E) -> ER, + input: ::std::rc::Rc>, + converter_t: fn(&T) -> TR, + converter_e: fn(&E) -> ER, ) -> Result { - match &*input { - crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), - crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), - } + match &*input { + crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), + crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), + } } pub fn result_to_dafny( - input: &Result, - converter_t: fn(&TR) -> T, - converter_e: fn(&ER) -> E, + input: &Result, + converter_t: fn(&TR) -> T, + converter_e: fn(&ER) -> E, ) -> ::std::rc::Rc> { - match input { - Ok(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: converter_t(&value) - } - ), - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: converter_e(&error) - } - ), - } -} \ No newline at end of file + match input { + Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { + value: converter_t(&value), + }), + Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { + error: converter_e(&error), + }), + } +} diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/standard_library_externs.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types.rs index 92447294d..3154f39ef 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types.rs @@ -1,4 +1,5 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `SimpleDoubleConfig` pub mod simple_double_config; diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types/simple_double_config.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types/simple_double_config.rs index b77665629..46db0da2e 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types/simple_double_config.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types/simple_double_config.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct SimpleDoubleConfig {} diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/wrapped.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/wrapped.rs new file mode 100644 index 000000000..2b7522dd2 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/wrapped.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod client; + +impl crate::r#simple::types::smithydouble::internaldafny::wrapped::_default { + pub fn WrappedSimpleDouble(config: &::std::rc::Rc< + crate::r#simple::types::smithydouble::internaldafny::types::SimpleDoubleConfig, + >) -> ::std::rc::Rc, + ::std::rc::Rc + >>{ + crate::wrapped::client::Client::from_conf(config) + } +} diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/wrapped/client.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/wrapped/client.rs new file mode 100644 index 000000000..281878c6a --- /dev/null +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/wrapped/client.rs @@ -0,0 +1,89 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use tokio::runtime::Runtime; + +pub struct Client { + wrapped: crate::client::Client, + + /// A `current_thread` runtime for executing operations on the + /// asynchronous client in a blocking manner. + rt: Runtime +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn crate::r#simple::types::smithydouble::internaldafny::types::ISimpleTypesDoubleClient); +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); +} + +impl Client { + pub fn from_conf(config: &::std::rc::Rc< + crate::r#simple::types::smithydouble::internaldafny::types::SimpleDoubleConfig, + >) -> +::std::rc::Rc, + ::std::rc::Rc +>> { + let rt_result = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build(); + let rt = match rt_result { + Ok(x) => x, + Err(error) => return crate::conversions::error::to_opaque_error_result(error), + }; + let result = crate::client::Client::from_conf( + crate::conversions::simple_double_config::_simple_double_config::from_dafny( + config.clone(), + ), + ); + match result { + Ok(client) => { + let wrap = crate::wrapped::client::Client { + wrapped: client, + rt + }; + std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(wrap)) + } + ) + }, + Err(error) => crate::conversions::error::to_opaque_error_result(error) + } + } +} + +impl crate::r#simple::types::smithydouble::internaldafny::types::ISimpleTypesDoubleClient for Client { + fn GetDouble( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::smithydouble::internaldafny::types::GetDoubleInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::smithydouble::internaldafny::types::GetDoubleOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_double::_get_double_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_double::GetDouble::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_double::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_double::_get_double_output::to_dafny(client), + }, + ), + } + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/Makefile b/TestModels/SimpleTypes/SimpleEnum/Makefile index a9e1e6bec..3a51f5719 100644 --- a/TestModels/SimpleTypes/SimpleEnum/Makefile +++ b/TestModels/SimpleTypes/SimpleEnum/Makefile @@ -3,8 +3,9 @@ CORES=2 +TRANSPILE_TESTS_IN_RUST=1 + ENABLE_EXTERN_PROCESSING=1 -RUST_BENERATED=1 include ../../SharedMakefile.mk diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/Cargo.toml b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/Cargo.toml index a3026b8a6..fb5b567bb 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/Cargo.toml +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/Cargo.toml @@ -5,13 +5,19 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +wrapped-client = [] + [dependencies] aws-smithy-runtime = {version = "1.6.0", features = ["client"] } aws-smithy-runtime-api = {version = "1.7.0", features = ["client"] } aws-smithy-types = "1.2.0" dafny_runtime = { path = "../../../../dafny-dependencies/dafny_runtime_rust"} -[dev-dependencies.tokio] +[dev-dependencies] +simple_enum = { path = ".", features = ["wrapped-client"] } + +[dependencies.tokio] version = "1.26.0" features = ["full"] diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client.rs index 9649346b6..3357e6854 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use aws_smithy_types::error::operation::BuildError; #[derive(::std::clone::Clone, ::std::fmt::Debug)] @@ -29,7 +30,7 @@ impl Client { )); } Ok(Self { - dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), + dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) }) } } @@ -37,5 +38,7 @@ impl Client { mod get_enum; mod get_enum_first_known_value_test; + mod get_enum_second_known_value_test; + mod get_enum_third_known_value_test; diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum.rs index f0c395251..1f8ad39bc 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum.rs @@ -1,11 +1,13 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { /// Constructs a fluent builder for the [`GetEnum`](crate::operation::get_enum::builders::GetEnumFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(SimpleEnumShape)`](crate::operation::get_enum::builders::GetEnumFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum::builders::GetEnumFluentBuilder::set_value):(undocumented)
+ /// - [`value(impl Into>)`](crate::operation::get_enum::builders::GetEnumFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum::builders::GetEnumFluentBuilder::set_value): (undocumented)
/// - On success, responds with [`GetEnumOutput`](crate::operation::get_enum::GetEnumOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_enum::GetEnumOutput::value): (undocumented) + /// - [`value(Option)`](crate::operation::get_enum::GetEnumOutput::value): (undocumented) /// - On failure, responds with [`SdkError`](crate::operation::get_enum::GetEnumError) pub fn get_enum(&self) -> crate::operation::get_enum::builders::GetEnumFluentBuilder { crate::operation::get_enum::builders::GetEnumFluentBuilder::new(self.clone()) diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_first_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_first_known_value_test.rs index a169931d8..fe5b423fa 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_first_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_first_known_value_test.rs @@ -1,18 +1,15 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { - /// Constructs a fluent builder for the [`GetEnum`](crate::operation::get_enum_first_known_value::builders::GetEnumFluentBuilder) operation. + /// Constructs a fluent builder for the [`GetEnumFirstKnownValueTest`](crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(SimpleEnumShape)`](crate::operation::get_enum_first_known_value::builders::GetEnumFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_first_known_value::builders::GetEnumFluentBuilder::set_value):(undocumented)
- /// - On success, responds with [`GetEnumOutput`](crate::operation::get_enum_first_known_value::GetEnumOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_enum_first_known_value::GetEnumOutput::value): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::get_enum_first_known_value::GetEnumError) - pub fn get_enum_first_known_value_test( - &self, - ) -> crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestFluentBuilder - { - crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestFluentBuilder::new( - self.clone(), - ) + /// - [`value(impl Into>)`](crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestFluentBuilder::set_value): (undocumented)
+ /// - On success, responds with [`GetEnumOutput`](crate::operation::get_enum_first_known_value_test::GetEnumOutput) with field(s): + /// - [`value(Option)`](crate::operation::get_enum_first_known_value_test::GetEnumOutput::value): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestError) + pub fn get_enum_first_known_value_test(&self) -> crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestFluentBuilder { + crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestFluentBuilder::new(self.clone()) } } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_second_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_second_known_value_test.rs index 8e4ec068d..4e9a16e55 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_second_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_second_known_value_test.rs @@ -1,18 +1,15 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { - /// Constructs a fluent builder for the [`GetEnum`](crate::operation::get_enum_second_known_value::builders::GetEnumFluentBuilder) operation. + /// Constructs a fluent builder for the [`GetEnumSecondKnownValueTest`](crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(SimpleEnumShape)`](crate::operation::get_enum_second_known_value::builders::GetEnumFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_second_known_value::builders::GetEnumFluentBuilder::set_value):(undocumented)
- /// - On success, responds with [`GetEnumOutput`](crate::operation::get_enum_second_known_value::GetEnumOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_enum_second_known_value::GetEnumOutput::value): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::get_enum_second_known_value::GetEnumError) - pub fn get_enum_second_known_value_test( - &self, - ) -> crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestFluentBuilder - { - crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestFluentBuilder::new( - self.clone(), - ) + /// - [`value(impl Into>)`](crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestFluentBuilder::set_value): (undocumented)
+ /// - On success, responds with [`GetEnumOutput`](crate::operation::get_enum_second_known_value_test::GetEnumOutput) with field(s): + /// - [`value(Option)`](crate::operation::get_enum_second_known_value_test::GetEnumOutput::value): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestError) + pub fn get_enum_second_known_value_test(&self) -> crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestFluentBuilder { + crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestFluentBuilder::new(self.clone()) } } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_third_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_third_known_value_test.rs index 47bdeb2fd..01060bfee 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_third_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_third_known_value_test.rs @@ -1,18 +1,15 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { - /// Constructs a fluent builder for the [`GetEnum`](crate::operation::get_enum_third_known_value::builders::GetEnumFluentBuilder) operation. + /// Constructs a fluent builder for the [`GetEnumThirdKnownValueTest`](crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(SimpleEnumShape)`](crate::operation::get_enum_third_known_value::builders::GetEnumFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_third_known_value::builders::GetEnumFluentBuilder::set_value):(undocumented)
- /// - On success, responds with [`GetEnumOutput`](crate::operation::get_enum_third_known_value::GetEnumOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_enum_third_known_value::GetEnumOutput::value): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::get_enum_third_known_value::GetEnumError) - pub fn get_enum_third_known_value_test( - &self, - ) -> crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestFluentBuilder - { - crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestFluentBuilder::new( - self.clone(), - ) + /// - [`value(impl Into>)`](crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestFluentBuilder::set_value): (undocumented)
+ /// - On success, responds with [`GetEnumOutput`](crate::operation::get_enum_third_known_value_test::GetEnumOutput) with field(s): + /// - [`value(Option)`](crate::operation::get_enum_third_known_value_test::GetEnumOutput::value): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestError) + pub fn get_enum_third_known_value_test(&self) -> crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestFluentBuilder { + crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestFluentBuilder::new(self.clone()) } } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions.rs index 7361ee56f..23444400b 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions.rs @@ -1,9 +1,16 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub mod get_enum; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod error; -pub mod get_enum_first_known_value_test; -pub mod get_enum_second_known_value_test; -pub mod get_enum_third_known_value_test; + pub mod get_enum; -pub mod simple_enum_config; -pub mod simple_enum_shape; + pub mod get_enum_first_known_value_test; + + pub mod get_enum_second_known_value_test; + + pub mod get_enum_third_known_value_test; + + pub mod simple_enum_config; + + pub mod simple_enum_shape; diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/error.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/error.rs new file mode 100644 index 000000000..b16869c83 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/error.rs @@ -0,0 +1,32 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + /// Wraps up an arbitrary Rust Error value as a Dafny Error +pub fn to_opaque_error(value: E) -> + ::std::rc::Rc +{ + let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( + ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), + )); + ::std::rc::Rc::new( + crate::r#simple::types::smithyenum::internaldafny::types::Error::Opaque { + obj: error_obj, + }, + ) +} + +/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure +pub fn to_opaque_error_result(value: E) -> + ::std::rc::Rc< + crate::_Wrappers_Compile::Result< + T, + ::std::rc::Rc + > + > +{ + ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: to_opaque_error(value), + }, + ) +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum.rs index ef493d119..6d75d851f 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_input.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_input.rs index 3bbf16021..6d65b8952 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_input.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_input.rs @@ -1,45 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_enum::GetEnumInput, ) -> ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_shape::_simple_enum_shape::to_dafny(&v), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput::GetEnumInput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput, >, ) -> crate::operation::get_enum::GetEnumInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_shape::_simple_enum_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum::GetEnumInput { value } + crate::operation::get_enum::GetEnumInput::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_output.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_output.rs index 1ae04378c..8511c2d0b 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_output.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_output.rs @@ -1,45 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_enum::GetEnumOutput, ) -> ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput, -> { - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_shape::_simple_enum_shape::to_dafny(&b), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput::GetEnumOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput, >, ) -> crate::operation::get_enum::GetEnumOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_shape::_simple_enum_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum::GetEnumOutput { value } + crate::operation::get_enum::GetEnumOutput::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test.rs index 5e3e946f3..51b4ad7bd 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs index 453989647..bd024fe5c 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs @@ -1,45 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestInput, + value: crate::operation::get_enum_first_known_value_test::GetEnumInput, ) -> ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_shape::_simple_enum_shape::to_dafny(&v), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput::GetEnumInput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput, >, -) -> crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_shape::_simple_enum_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestInput { value } +) -> crate::operation::get_enum_first_known_value_test::GetEnumInput { + crate::operation::get_enum_first_known_value_test::GetEnumInput::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs index c31403c9c..0b94ed08a 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs @@ -1,45 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestOutput, + value: crate::operation::get_enum_first_known_value_test::GetEnumOutput, ) -> ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput, -> { - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_shape::_simple_enum_shape::to_dafny(&b), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput::GetEnumOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput, >, -) -> crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_shape::_simple_enum_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestOutput { value } +) -> crate::operation::get_enum_first_known_value_test::GetEnumOutput { + crate::operation::get_enum_first_known_value_test::GetEnumOutput::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test.rs index afa0c42cd..37724a368 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs index c73d8a630..0124095fb 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs @@ -1,45 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestInput, + value: crate::operation::get_enum_second_known_value_test::GetEnumInput, ) -> ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_shape::_simple_enum_shape::to_dafny(&v), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput::GetEnumInput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput, >, -) -> crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_shape::_simple_enum_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestInput { value } +) -> crate::operation::get_enum_second_known_value_test::GetEnumInput { + crate::operation::get_enum_second_known_value_test::GetEnumInput::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs index fbb2809ed..6f9b39a9a 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs @@ -1,45 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestOutput, + value: crate::operation::get_enum_second_known_value_test::GetEnumOutput, ) -> ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput, -> { - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_shape::_simple_enum_shape::to_dafny(&b), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput::GetEnumOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput, >, -) -> crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_shape::_simple_enum_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestOutput { value } +) -> crate::operation::get_enum_second_known_value_test::GetEnumOutput { + crate::operation::get_enum_second_known_value_test::GetEnumOutput::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test.rs index b3d8d1186..8860c8548 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs index 73c9d9b6f..bf7ce0415 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs @@ -1,45 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestInput, + value: crate::operation::get_enum_third_known_value_test::GetEnumInput, ) -> ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_shape::_simple_enum_shape::to_dafny(&v), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput::GetEnumInput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput, >, -) -> crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_shape::_simple_enum_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestInput { value } +) -> crate::operation::get_enum_third_known_value_test::GetEnumInput { + crate::operation::get_enum_third_known_value_test::GetEnumInput::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs index aafc1403e..0199b60a8 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs @@ -1,45 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestOutput, + value: crate::operation::get_enum_third_known_value_test::GetEnumOutput, ) -> ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput, -> { - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_shape::_simple_enum_shape::to_dafny(&b), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput::GetEnumOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput, >, -) -> crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_shape::_simple_enum_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestOutput { value } +) -> crate::operation::get_enum_third_known_value_test::GetEnumOutput { + crate::operation::get_enum_third_known_value_test::GetEnumOutput::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config.rs index 973679ee2..6b6b7d9e3 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config.rs @@ -1,3 +1,4 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub mod _simple_enum_config; diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config/_simple_enum_config.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config/_simple_enum_config.rs index a1e48e7f0..3fcaeb06a 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config/_simple_enum_config.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config/_simple_enum_config.rs @@ -1,10 +1,12 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::types::simple_enum_config::SimpleEnumConfig, ) -> ::std::rc::Rc< - crate::simple::types::smithyenum::internaldafny::types::SimpleEnumConfig, + crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumConfig, > { ::std::rc::Rc::new(crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumConfig::SimpleEnumConfig {}) } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape.rs index f531b5531..994d63ed8 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape.rs @@ -1,3 +1,25 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] -pub mod _simple_enum_shape; +pub fn to_dafny( + value: crate::types::SimpleEnumShape, +) -> ::std::rc::Rc{ + ::std::rc::Rc::new(match value { + crate::types::SimpleEnumShape::First => crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape::FIRST {}, +crate::types::SimpleEnumShape::Second => crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape::SECOND {}, +crate::types::SimpleEnumShape::Third => crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape::THIRD {}, + _ => panic!("Unknown enum variant: {}", value), + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: &crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape, +) -> crate::types::SimpleEnumShape { + match dafny_value { + crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape::FIRST {} => crate::types::SimpleEnumShape::First, +crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape::SECOND {} => crate::types::SimpleEnumShape::Second, +crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape::THIRD {} => crate::types::SimpleEnumShape::Third, + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape/_simple_enum_shape.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape/_simple_enum_shape.rs deleted file mode 100644 index 8519605a7..000000000 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape/_simple_enum_shape.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(dead_code)] - -pub fn to_dafny( - value: &crate::types::simple_enum_shape::SimpleEnumShape, -) -> crate::simple::types::smithyenum::internaldafny::types::SimpleEnumShape { - match value { - crate::types::simple_enum_shape::SimpleEnumShape::FIRST => crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape::FIRST {}, - crate::types::simple_enum_shape::SimpleEnumShape::SECOND => crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape::SECOND {}, - crate::types::simple_enum_shape::SimpleEnumShape::THIRD => crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape::THIRD {}, - } -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape, -) -> crate::types::simple_enum_shape::SimpleEnumShape { - match dafny_value { - crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape::FIRST {} => crate::types::simple_enum_shape::SimpleEnumShape::FIRST, - crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape::SECOND {} => crate::types::simple_enum_shape::SimpleEnumShape::SECOND, - crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumShape::THIRD {} => crate::types::simple_enum_shape::SimpleEnumShape::THIRD, - } -} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error.rs index ec89cbecc..4cddaa7c3 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use ::aws_smithy_runtime_api::box_error::BoxError; /// Error type returned by the client. diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error/sealed_unhandled.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error/sealed_unhandled.rs index cce22d1cf..eae800729 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error/sealed_unhandled.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error/sealed_unhandled.rs @@ -1,4 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::any::Any; + +use dafny_runtime::UpcastObject; + /// This struct is not intended to be used. /// /// This struct holds information about an unhandled error, @@ -21,6 +27,6 @@ pub struct Unhandled { pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, } -impl ::dafny_runtime::UpcastObject for Unhandled { +impl UpcastObject for Unhandled { ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/lib.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/lib.rs deleted file mode 100644 index f914e7ba9..000000000 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/lib.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![allow(deprecated)] - -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -pub mod client; -pub mod types; - -/// Common errors and error handling utilities. -pub mod error; - -/// All operations that this crate can perform. -pub mod operation; - -mod conversions; - -pub mod implementation_from_dafny; - -pub use client::Client; -pub use types::simple_enum_config::SimpleEnumConfig; diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation.rs index 560af2715..febf44fb0 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation.rs @@ -1,9 +1,14 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `GetEnum` operation. pub mod get_enum; -/// Types for the `GetEnumKnownValue` operation. +/// Types for the `GetEnumFirstKnownValueTest` operation. pub mod get_enum_first_known_value_test; + +/// Types for the `GetEnumSecondKnownValueTest` operation. pub mod get_enum_second_known_value_test; + +/// Types for the `GetEnumThirdKnownValueTest` operation. pub mod get_enum_third_known_value_test; diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum.rs index d75b5ac44..58f7c6410 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetEnum`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -16,14 +18,17 @@ impl GetEnum { crate::operation::get_enum::GetEnumError, > { let inner_input = crate::conversions::get_enum::_get_enum_input::to_dafny(input); - let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()).GetEnum(&inner_input); + let inner_result = + ::dafny_runtime::md!(client.dafny_client.clone()).GetEnum(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } ) { - Ok(crate::conversions::get_enum::_get_enum_output::from_dafny( - inner_result.value().clone(), - )) + Ok( + crate::conversions::get_enum::_get_enum_output::from_dafny( + inner_result.value().clone(), + ), + ) } else { Err(crate::conversions::get_enum::from_dafny_error( inner_result.error().clone(), @@ -134,9 +139,9 @@ pub use crate::operation::get_enum::_get_enum_output::GetEnumOutput; pub use crate::operation::get_enum::_get_enum_input::GetEnumInput; -mod _get_enum_input; +pub(crate) mod _get_enum_output; -mod _get_enum_output; +pub(crate) mod _get_enum_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_input.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_input.rs index 37b1f16c1..5308a7b96 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_input.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_input.rs @@ -1,19 +1,18 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetEnumInput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, +pub value: ::std::option::Option, } impl GetEnumInput { #[allow(missing_docs)] // documentation missing in model - pub fn message( - &self, - ) -> ::std::option::Option<&crate::types::simple_enum_shape::SimpleEnumShape> { - self.value.as_ref() - } +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} } impl GetEnumInput { /// Creates a new builder-style object to manufacture [`GetEnumInput`](crate::operation::operation::GetEnumInput). @@ -28,31 +27,23 @@ impl GetEnumInput { ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, )] pub struct GetEnumInputBuilder { - pub(crate) value: ::std::option::Option, + pub(crate) value: ::std::option::Option, } impl GetEnumInputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} /// Consumes the builder and constructs a [`GetEnumInput`](crate::operation::operation::GetEnumInput). pub fn build( self, @@ -60,6 +51,8 @@ impl GetEnumInputBuilder { crate::operation::get_enum::GetEnumInput, ::aws_smithy_types::error::operation::BuildError, > { - ::std::result::Result::Ok(crate::operation::get_enum::GetEnumInput { value: self.value }) + ::std::result::Result::Ok(crate::operation::get_enum::GetEnumInput { + value: self.value, + }) } } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_output.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_output.rs index 9675cc2c2..7a05b95d3 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_output.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_output.rs @@ -1,20 +1,19 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetEnumOutput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, +pub value: ::std::option::Option, } - impl GetEnumOutput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} } - impl GetEnumOutput { /// Creates a new builder-style object to manufacture [`GetEnumOutput`](crate::operation::operation::GetEnumOutput). pub fn builder() -> crate::operation::get_enum::builders::GetEnumOutputBuilder { @@ -28,35 +27,23 @@ impl GetEnumOutput { ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, )] pub struct GetEnumOutputBuilder { - pub(crate) value: ::std::option::Option, + pub(crate) value: ::std::option::Option, } - impl GetEnumOutputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} /// Consumes the builder and constructs a [`GetEnumOutput`](crate::operation::operation::GetEnumOutput). pub fn build( self, @@ -64,6 +51,8 @@ impl GetEnumOutputBuilder { crate::operation::get_enum::GetEnumOutput, ::aws_smithy_types::error::operation::BuildError, > { - ::std::result::Result::Ok(crate::operation::get_enum::GetEnumOutput { value: self.value }) + ::std::result::Result::Ok(crate::operation::get_enum::GetEnumOutput { + value: self.value, + }) } } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/builders.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/builders.rs index 11e371c13..34ee4503e 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/builders.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/builders.rs @@ -1,7 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_enum::_get_enum_input::GetEnumInputBuilder; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use crate::operation::get_enum::_get_enum_output::GetEnumOutputBuilder; +pub use crate::operation::get_enum::_get_enum_input::GetEnumInputBuilder; + impl GetEnumInputBuilder { /// Sends a request with this input using the given client. pub async fn send_with( @@ -21,7 +24,7 @@ impl GetEnumInputBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetEnumFluentBuilder { client: crate::client::Client, - inner: crate::operation::get_enum::builders::GetEnumInputBuilder, + pub(crate) inner: crate::operation::get_enum::builders::GetEnumInputBuilder, } impl GetEnumFluentBuilder { /// Creates a new `GetEnum`. @@ -55,22 +58,17 @@ impl GetEnumFluentBuilder { } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: crate::types::simple_enum_shape::SimpleEnumShape) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test.rs index 106ec1702..43bf7cd23 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetEnumFirstKnownValueTest`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -10,14 +12,14 @@ impl GetEnumFirstKnownValueTest { } pub(crate) async fn send( client: &crate::client::Client, - input: crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestInput, + input: crate::operation::get_enum_first_known_value_test::GetEnumInput, ) -> ::std::result::Result< - crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestOutput, + crate::operation::get_enum_first_known_value_test::GetEnumOutput, crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestError, > { - let inner_input = - crate::conversions::get_enum_first_known_value_test::_get_enum_first_known_value_test_input::to_dafny(input); - let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()).GetEnum(&inner_input); + let inner_input = crate::conversions::get_enum_first_known_value_test::_get_enum_first_known_value_test_input::to_dafny(input); + let inner_result = + ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumFirstKnownValueTest(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } @@ -28,11 +30,9 @@ impl GetEnumFirstKnownValueTest { ), ) } else { - Err( - crate::conversions::get_enum_first_known_value_test::from_dafny_error( - inner_result.error().clone(), - ), - ) + Err(crate::conversions::get_enum_first_known_value_test::from_dafny_error( + inner_result.error().clone(), + )) } } } @@ -41,7 +41,7 @@ impl GetEnumFirstKnownValueTest { #[non_exhaustive] #[derive(::std::fmt::Debug)] pub enum GetEnumFirstKnownValueTestError { - /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unfirst_known error code). + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). #[deprecated( note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ variable wildcard pattern and check `.code()`: @@ -121,9 +121,7 @@ impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetEnumFirstK } } } -impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError - for GetEnumFirstKnownValueTestError -{ +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetEnumFirstKnownValueTestError { fn create_unhandled_error( source: ::std::boxed::Box< dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, @@ -137,13 +135,13 @@ impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError } } -pub use crate::operation::get_enum_first_known_value_test::_get_enum_first_known_value_test_output::GetEnumFirstKnownValueTestOutput; +pub use crate::operation::get_enum_first_known_value_test::_get_enum_output::GetEnumOutput; -pub use crate::operation::get_enum_first_known_value_test::_get_enum_first_known_value_test_input::GetEnumFirstKnownValueTestInput; +pub use crate::operation::get_enum_first_known_value_test::_get_enum_input::GetEnumInput; -mod _get_enum_first_known_value_test_input; +pub(crate) mod _get_enum_output; -mod _get_enum_first_known_value_test_output; +pub(crate) mod _get_enum_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs deleted file mode 100644 index 866727550..000000000 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetEnumFirstKnownValueTestInput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetEnumFirstKnownValueTestInput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } -} -impl GetEnumFirstKnownValueTestInput { - /// Creates a new builder-style object to manufacture [`GetEnumFirstKnownValueTestInput`](crate::operation::operation::GetEnumFirstKnownValueTestInput). - pub fn builder( - ) -> crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestInputBuilder - { - crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestInputBuilder::default() - } -} - -/// A builder for [`GetEnumFirstKnownValueTestInput`](crate::operation::operation::GetEnumFirstKnownValueTestInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetEnumFirstKnownValueTestInputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetEnumFirstKnownValueTestInputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetEnumFirstKnownValueTestInput`](crate::operation::operation::GetEnumFirstKnownValueTestInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestInput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs deleted file mode 100644 index 65154c962..000000000 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetEnumFirstKnownValueTestOutput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetEnumFirstKnownValueTestOutput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } -} -impl GetEnumFirstKnownValueTestOutput { - /// Creates a new builder-style object to manufacture [`GetEnumFirstKnownValueTestOutput`](crate::operation::operation::GetEnumFirstKnownValueTestOutput). - pub fn builder( - ) -> crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestOutputBuilder - { - crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestOutputBuilder::default() - } -} - -/// A builder for [`GetEnumFirstKnownValueTestOutput`](crate::operation::operation::GetEnumFirstKnownValueTestOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetEnumFirstKnownValueTestOutputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetEnumFirstKnownValueTestOutputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetEnumFirstKnownValueTestOutput`](crate::operation::operation::GetEnumFirstKnownValueTestOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestOutput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_input.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_input.rs new file mode 100644 index 000000000..9ebdf0a65 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEnumInput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option, +} +impl GetEnumInput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} +} +impl GetEnumInput { + /// Creates a new builder-style object to manufacture [`GetEnumInput`](crate::operation::operation::GetEnumInput). + pub fn builder() -> crate::operation::get_enum_first_known_value_test::builders::GetEnumInputBuilder { + crate::operation::get_enum_first_known_value_test::builders::GetEnumInputBuilder::default() + } +} + +/// A builder for [`GetEnumInput`](crate::operation::operation::GetEnumInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetEnumInputBuilder { + pub(crate) value: ::std::option::Option, +} +impl GetEnumInputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} + /// Consumes the builder and constructs a [`GetEnumInput`](crate::operation::operation::GetEnumInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_enum_first_known_value_test::GetEnumInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_enum_first_known_value_test::GetEnumInput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_output.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_output.rs new file mode 100644 index 000000000..78d1bf208 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEnumOutput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option, +} +impl GetEnumOutput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} +} +impl GetEnumOutput { + /// Creates a new builder-style object to manufacture [`GetEnumOutput`](crate::operation::operation::GetEnumOutput). + pub fn builder() -> crate::operation::get_enum_first_known_value_test::builders::GetEnumOutputBuilder { + crate::operation::get_enum_first_known_value_test::builders::GetEnumOutputBuilder::default() + } +} + +/// A builder for [`GetEnumOutput`](crate::operation::operation::GetEnumOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetEnumOutputBuilder { + pub(crate) value: ::std::option::Option, +} +impl GetEnumOutputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} + /// Consumes the builder and constructs a [`GetEnumOutput`](crate::operation::operation::GetEnumOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_enum_first_known_value_test::GetEnumOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_enum_first_known_value_test::GetEnumOutput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/builders.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/builders.rs index ca84c9774..4da9155d3 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/builders.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/builders.rs @@ -1,14 +1,17 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_enum_first_known_value_test::_get_enum_first_known_value_test_input::GetEnumFirstKnownValueTestInputBuilder; -pub use crate::operation::get_enum_first_known_value_test::_get_enum_first_known_value_test_output::GetEnumFirstKnownValueTestOutputBuilder; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::get_enum_first_known_value_test::_get_enum_output::GetEnumOutputBuilder; -impl GetEnumFirstKnownValueTestInputBuilder { +pub use crate::operation::get_enum_first_known_value_test::_get_enum_input::GetEnumInputBuilder; + +impl GetEnumInputBuilder { /// Sends a request with this input using the given client. pub async fn send_with( self, client: &crate::Client, ) -> ::std::result::Result< - crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestOutput, + crate::operation::get_enum_first_known_value_test::GetEnumOutput, crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestError, > { let mut fluent_builder = client.get_enum_first_known_value_test(); @@ -21,8 +24,7 @@ impl GetEnumFirstKnownValueTestInputBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetEnumFirstKnownValueTestFluentBuilder { client: crate::client::Client, - inner: - crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestInputBuilder, + pub(crate) inner: crate::operation::get_enum_first_known_value_test::builders::GetEnumInputBuilder, } impl GetEnumFirstKnownValueTestFluentBuilder { /// Creates a new `GetEnumFirstKnownValueTest`. @@ -33,52 +35,40 @@ impl GetEnumFirstKnownValueTestFluentBuilder { } } /// Access the GetEnumFirstKnownValueTest as a reference. - pub fn as_input( - &self, - ) -> &crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestInputBuilder - { + pub fn as_input(&self) -> &crate::operation::get_enum_first_known_value_test::builders::GetEnumInputBuilder { &self.inner } /// Sends the request and returns the response. pub async fn send( self, ) -> ::std::result::Result< - crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestOutput, + crate::operation::get_enum_first_known_value_test::GetEnumOutput, crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestError, > { let input = self .inner .build() - // Using unhandled since GetEnum doesn't declare any validation, + // Using unhandled since GetEnumFirstKnownValueTest doesn't declare any validation, // and smithy-rs seems to not generate a ValidationError case unless there is // (but isn't that a backwards compatibility problem for output structures?) // Vanilla smithy-rs uses SdkError::construction_failure, // but we aren't using SdkError. .map_err(crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestError::unhandled)?; - crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTest::send( - &self.client, - input, - ) - .await + crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTest::send(&self.client, input).await } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: crate::types::simple_enum_shape::SimpleEnumShape) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test.rs index b59e0ce56..af28939f9 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetEnumSecondKnownValueTest`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -10,14 +12,14 @@ impl GetEnumSecondKnownValueTest { } pub(crate) async fn send( client: &crate::client::Client, - input: crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestInput, + input: crate::operation::get_enum_second_known_value_test::GetEnumInput, ) -> ::std::result::Result< - crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestOutput, + crate::operation::get_enum_second_known_value_test::GetEnumOutput, crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestError, > { - let inner_input = - crate::conversions::get_enum_second_known_value_test::_get_enum_second_known_value_test_input::to_dafny(input); - let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()).GetEnum(&inner_input); + let inner_input = crate::conversions::get_enum_second_known_value_test::_get_enum_second_known_value_test_input::to_dafny(input); + let inner_result = + ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumSecondKnownValueTest(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } @@ -28,11 +30,9 @@ impl GetEnumSecondKnownValueTest { ), ) } else { - Err( - crate::conversions::get_enum_second_known_value_test::from_dafny_error( - inner_result.error().clone(), - ), - ) + Err(crate::conversions::get_enum_second_known_value_test::from_dafny_error( + inner_result.error().clone(), + )) } } } @@ -41,7 +41,7 @@ impl GetEnumSecondKnownValueTest { #[non_exhaustive] #[derive(::std::fmt::Debug)] pub enum GetEnumSecondKnownValueTestError { - /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unsecond_known error code). + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). #[deprecated( note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ variable wildcard pattern and check `.code()`: @@ -114,18 +114,14 @@ impl ::aws_smithy_types::retry::ProvideErrorKind for GetEnumSecondKnownValueTest ::std::option::Option::None } } -impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata - for GetEnumSecondKnownValueTestError -{ +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetEnumSecondKnownValueTestError { fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { match self { Self::Unhandled(_inner) => &_inner.meta, } } } -impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError - for GetEnumSecondKnownValueTestError -{ +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetEnumSecondKnownValueTestError { fn create_unhandled_error( source: ::std::boxed::Box< dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, @@ -139,13 +135,13 @@ impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError } } -pub use crate::operation::get_enum_second_known_value_test::_get_enum_second_known_value_test_output::GetEnumSecondKnownValueTestOutput; +pub use crate::operation::get_enum_second_known_value_test::_get_enum_output::GetEnumOutput; -pub use crate::operation::get_enum_second_known_value_test::_get_enum_second_known_value_test_input::GetEnumSecondKnownValueTestInput; +pub use crate::operation::get_enum_second_known_value_test::_get_enum_input::GetEnumInput; -mod _get_enum_second_known_value_test_input; +pub(crate) mod _get_enum_output; -mod _get_enum_second_known_value_test_output; +pub(crate) mod _get_enum_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_input.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_input.rs new file mode 100644 index 000000000..494cb0157 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEnumInput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option, +} +impl GetEnumInput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} +} +impl GetEnumInput { + /// Creates a new builder-style object to manufacture [`GetEnumInput`](crate::operation::operation::GetEnumInput). + pub fn builder() -> crate::operation::get_enum_second_known_value_test::builders::GetEnumInputBuilder { + crate::operation::get_enum_second_known_value_test::builders::GetEnumInputBuilder::default() + } +} + +/// A builder for [`GetEnumInput`](crate::operation::operation::GetEnumInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetEnumInputBuilder { + pub(crate) value: ::std::option::Option, +} +impl GetEnumInputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} + /// Consumes the builder and constructs a [`GetEnumInput`](crate::operation::operation::GetEnumInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_enum_second_known_value_test::GetEnumInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_enum_second_known_value_test::GetEnumInput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_output.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_output.rs new file mode 100644 index 000000000..355865e93 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEnumOutput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option, +} +impl GetEnumOutput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} +} +impl GetEnumOutput { + /// Creates a new builder-style object to manufacture [`GetEnumOutput`](crate::operation::operation::GetEnumOutput). + pub fn builder() -> crate::operation::get_enum_second_known_value_test::builders::GetEnumOutputBuilder { + crate::operation::get_enum_second_known_value_test::builders::GetEnumOutputBuilder::default() + } +} + +/// A builder for [`GetEnumOutput`](crate::operation::operation::GetEnumOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetEnumOutputBuilder { + pub(crate) value: ::std::option::Option, +} +impl GetEnumOutputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} + /// Consumes the builder and constructs a [`GetEnumOutput`](crate::operation::operation::GetEnumOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_enum_second_known_value_test::GetEnumOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_enum_second_known_value_test::GetEnumOutput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs deleted file mode 100644 index 3fb03429b..000000000 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetEnumSecondKnownValueTestInput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetEnumSecondKnownValueTestInput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } -} -impl GetEnumSecondKnownValueTestInput { - /// Creates a new builder-style object to manufacture [`GetEnumSecondKnownValueTestInput`](crate::operation::operation::GetEnumSecondKnownValueTestInput). - pub fn builder( - ) -> crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestInputBuilder - { - crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestInputBuilder::default() - } -} - -/// A builder for [`GetEnumSecondKnownValueTestInput`](crate::operation::operation::GetEnumSecondKnownValueTestInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetEnumSecondKnownValueTestInputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetEnumSecondKnownValueTestInputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetEnumSecondKnownValueTestInput`](crate::operation::operation::GetEnumSecondKnownValueTestInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestInput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs deleted file mode 100644 index 693702505..000000000 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetEnumSecondKnownValueTestOutput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetEnumSecondKnownValueTestOutput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } -} -impl GetEnumSecondKnownValueTestOutput { - /// Creates a new builder-style object to manufacture [`GetEnumSecondKnownValueTestOutput`](crate::operation::operation::GetEnumSecondKnownValueTestOutput). - pub fn builder( - ) -> crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestOutputBuilder - { - crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestOutputBuilder::default() - } -} - -/// A builder for [`GetEnumSecondKnownValueTestOutput`](crate::operation::operation::GetEnumSecondKnownValueTestOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetEnumSecondKnownValueTestOutputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetEnumSecondKnownValueTestOutputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetEnumSecondKnownValueTestOutput`](crate::operation::operation::GetEnumSecondKnownValueTestOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestOutput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/builders.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/builders.rs index e54348b36..1d0afa3fc 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/builders.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/builders.rs @@ -1,14 +1,17 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_enum_second_known_value_test::_get_enum_second_known_value_test_input::GetEnumSecondKnownValueTestInputBuilder; -pub use crate::operation::get_enum_second_known_value_test::_get_enum_second_known_value_test_output::GetEnumSecondKnownValueTestOutputBuilder; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::get_enum_second_known_value_test::_get_enum_output::GetEnumOutputBuilder; -impl GetEnumSecondKnownValueTestInputBuilder { +pub use crate::operation::get_enum_second_known_value_test::_get_enum_input::GetEnumInputBuilder; + +impl GetEnumInputBuilder { /// Sends a request with this input using the given client. pub async fn send_with( self, client: &crate::Client, ) -> ::std::result::Result< - crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestOutput, + crate::operation::get_enum_second_known_value_test::GetEnumOutput, crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestError, > { let mut fluent_builder = client.get_enum_second_known_value_test(); @@ -21,7 +24,7 @@ impl GetEnumSecondKnownValueTestInputBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetEnumSecondKnownValueTestFluentBuilder { client: crate::client::Client, - inner: crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestInputBuilder, + pub(crate) inner: crate::operation::get_enum_second_known_value_test::builders::GetEnumInputBuilder, } impl GetEnumSecondKnownValueTestFluentBuilder { /// Creates a new `GetEnumSecondKnownValueTest`. @@ -32,52 +35,40 @@ impl GetEnumSecondKnownValueTestFluentBuilder { } } /// Access the GetEnumSecondKnownValueTest as a reference. - pub fn as_input( - &self, - ) -> &crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestInputBuilder - { + pub fn as_input(&self) -> &crate::operation::get_enum_second_known_value_test::builders::GetEnumInputBuilder { &self.inner } /// Sends the request and returns the response. pub async fn send( self, ) -> ::std::result::Result< - crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestOutput, + crate::operation::get_enum_second_known_value_test::GetEnumOutput, crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestError, > { let input = self .inner .build() - // Using unhandled since GetEnum doesn't declare any validation, + // Using unhandled since GetEnumSecondKnownValueTest doesn't declare any validation, // and smithy-rs seems to not generate a ValidationError case unless there is // (but isn't that a backwards compatibility problem for output structures?) // Vanilla smithy-rs uses SdkError::construction_failure, // but we aren't using SdkError. .map_err(crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestError::unhandled)?; - crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTest::send( - &self.client, - input, - ) - .await + crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTest::send(&self.client, input).await } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: crate::types::simple_enum_shape::SimpleEnumShape) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test.rs index d5def6ff2..0b3f62782 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetEnumThirdKnownValueTest`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -10,14 +12,14 @@ impl GetEnumThirdKnownValueTest { } pub(crate) async fn send( client: &crate::client::Client, - input: crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestInput, + input: crate::operation::get_enum_third_known_value_test::GetEnumInput, ) -> ::std::result::Result< - crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestOutput, + crate::operation::get_enum_third_known_value_test::GetEnumOutput, crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestError, > { - let inner_input = - crate::conversions::get_enum_third_known_value_test::_get_enum_third_known_value_test_input::to_dafny(input); - let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()).GetEnum(&inner_input); + let inner_input = crate::conversions::get_enum_third_known_value_test::_get_enum_third_known_value_test_input::to_dafny(input); + let inner_result = + ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumThirdKnownValueTest(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } @@ -28,11 +30,9 @@ impl GetEnumThirdKnownValueTest { ), ) } else { - Err( - crate::conversions::get_enum_third_known_value_test::from_dafny_error( - inner_result.error().clone(), - ), - ) + Err(crate::conversions::get_enum_third_known_value_test::from_dafny_error( + inner_result.error().clone(), + )) } } } @@ -41,7 +41,7 @@ impl GetEnumThirdKnownValueTest { #[non_exhaustive] #[derive(::std::fmt::Debug)] pub enum GetEnumThirdKnownValueTestError { - /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unthird_known error code). + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). #[deprecated( note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ variable wildcard pattern and check `.code()`: @@ -121,9 +121,7 @@ impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetEnumThirdK } } } -impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError - for GetEnumThirdKnownValueTestError -{ +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetEnumThirdKnownValueTestError { fn create_unhandled_error( source: ::std::boxed::Box< dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, @@ -137,13 +135,13 @@ impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError } } -pub use crate::operation::get_enum_third_known_value_test::_get_enum_third_known_value_test_output::GetEnumThirdKnownValueTestOutput; +pub use crate::operation::get_enum_third_known_value_test::_get_enum_output::GetEnumOutput; -pub use crate::operation::get_enum_third_known_value_test::_get_enum_third_known_value_test_input::GetEnumThirdKnownValueTestInput; +pub use crate::operation::get_enum_third_known_value_test::_get_enum_input::GetEnumInput; -mod _get_enum_third_known_value_test_input; +pub(crate) mod _get_enum_output; -mod _get_enum_third_known_value_test_output; +pub(crate) mod _get_enum_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_input.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_input.rs new file mode 100644 index 000000000..5529bb5f1 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEnumInput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option, +} +impl GetEnumInput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} +} +impl GetEnumInput { + /// Creates a new builder-style object to manufacture [`GetEnumInput`](crate::operation::operation::GetEnumInput). + pub fn builder() -> crate::operation::get_enum_third_known_value_test::builders::GetEnumInputBuilder { + crate::operation::get_enum_third_known_value_test::builders::GetEnumInputBuilder::default() + } +} + +/// A builder for [`GetEnumInput`](crate::operation::operation::GetEnumInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetEnumInputBuilder { + pub(crate) value: ::std::option::Option, +} +impl GetEnumInputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} + /// Consumes the builder and constructs a [`GetEnumInput`](crate::operation::operation::GetEnumInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_enum_third_known_value_test::GetEnumInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_enum_third_known_value_test::GetEnumInput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_output.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_output.rs new file mode 100644 index 000000000..87d794f53 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEnumOutput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option, +} +impl GetEnumOutput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} +} +impl GetEnumOutput { + /// Creates a new builder-style object to manufacture [`GetEnumOutput`](crate::operation::operation::GetEnumOutput). + pub fn builder() -> crate::operation::get_enum_third_known_value_test::builders::GetEnumOutputBuilder { + crate::operation::get_enum_third_known_value_test::builders::GetEnumOutputBuilder::default() + } +} + +/// A builder for [`GetEnumOutput`](crate::operation::operation::GetEnumOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetEnumOutputBuilder { + pub(crate) value: ::std::option::Option, +} +impl GetEnumOutputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} + /// Consumes the builder and constructs a [`GetEnumOutput`](crate::operation::operation::GetEnumOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_enum_third_known_value_test::GetEnumOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_enum_third_known_value_test::GetEnumOutput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs deleted file mode 100644 index 275d472c0..000000000 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetEnumThirdKnownValueTestInput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetEnumThirdKnownValueTestInput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } -} -impl GetEnumThirdKnownValueTestInput { - /// Creates a new builder-style object to manufacture [`GetEnumThirdKnownValueTestInput`](crate::operation::operation::GetEnumThirdKnownValueTestInput). - pub fn builder( - ) -> crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestInputBuilder - { - crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestInputBuilder::default() - } -} - -/// A builder for [`GetEnumThirdKnownValueTestInput`](crate::operation::operation::GetEnumThirdKnownValueTestInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetEnumThirdKnownValueTestInputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetEnumThirdKnownValueTestInputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetEnumThirdKnownValueTestInput`](crate::operation::operation::GetEnumThirdKnownValueTestInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestInput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs deleted file mode 100644 index e1d498d3e..000000000 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetEnumThirdKnownValueTestOutput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetEnumThirdKnownValueTestOutput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } -} -impl GetEnumThirdKnownValueTestOutput { - /// Creates a new builder-style object to manufacture [`GetEnumThirdKnownValueTestOutput`](crate::operation::operation::GetEnumThirdKnownValueTestOutput). - pub fn builder( - ) -> crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestOutputBuilder - { - crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestOutputBuilder::default() - } -} - -/// A builder for [`GetEnumThirdKnownValueTestOutput`](crate::operation::operation::GetEnumThirdKnownValueTestOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetEnumThirdKnownValueTestOutputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetEnumThirdKnownValueTestOutputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetEnumThirdKnownValueTestOutput`](crate::operation::operation::GetEnumThirdKnownValueTestOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestOutput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/builders.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/builders.rs index db835240b..f51c94119 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/builders.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/builders.rs @@ -1,14 +1,17 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_enum_third_known_value_test::_get_enum_third_known_value_test_input::GetEnumThirdKnownValueTestInputBuilder; -pub use crate::operation::get_enum_third_known_value_test::_get_enum_third_known_value_test_output::GetEnumThirdKnownValueTestOutputBuilder; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::get_enum_third_known_value_test::_get_enum_output::GetEnumOutputBuilder; -impl GetEnumThirdKnownValueTestInputBuilder { +pub use crate::operation::get_enum_third_known_value_test::_get_enum_input::GetEnumInputBuilder; + +impl GetEnumInputBuilder { /// Sends a request with this input using the given client. pub async fn send_with( self, client: &crate::Client, ) -> ::std::result::Result< - crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestOutput, + crate::operation::get_enum_third_known_value_test::GetEnumOutput, crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestError, > { let mut fluent_builder = client.get_enum_third_known_value_test(); @@ -21,8 +24,7 @@ impl GetEnumThirdKnownValueTestInputBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetEnumThirdKnownValueTestFluentBuilder { client: crate::client::Client, - inner: - crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestInputBuilder, + pub(crate) inner: crate::operation::get_enum_third_known_value_test::builders::GetEnumInputBuilder, } impl GetEnumThirdKnownValueTestFluentBuilder { /// Creates a new `GetEnumThirdKnownValueTest`. @@ -33,52 +35,40 @@ impl GetEnumThirdKnownValueTestFluentBuilder { } } /// Access the GetEnumThirdKnownValueTest as a reference. - pub fn as_input( - &self, - ) -> &crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestInputBuilder - { + pub fn as_input(&self) -> &crate::operation::get_enum_third_known_value_test::builders::GetEnumInputBuilder { &self.inner } /// Sends the request and returns the response. pub async fn send( self, ) -> ::std::result::Result< - crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestOutput, + crate::operation::get_enum_third_known_value_test::GetEnumOutput, crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestError, > { let input = self .inner .build() - // Using unhandled since GetEnum doesn't declare any validation, + // Using unhandled since GetEnumThirdKnownValueTest doesn't declare any validation, // and smithy-rs seems to not generate a ValidationError case unless there is // (but isn't that a backwards compatibility problem for output structures?) // Vanilla smithy-rs uses SdkError::construction_failure, // but we aren't using SdkError. .map_err(crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestError::unhandled)?; - crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTest::send( - &self.client, - input, - ) - .await + crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTest::send(&self.client, input).await } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: crate::types::simple_enum_shape::SimpleEnumShape) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/standard_library_conversions.rs index 3a51134c6..6bf8297d8 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/standard_library_conversions.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/standard_library_conversions.rs @@ -1,246 +1,266 @@ pub fn ostring_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, > { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) - }, - None => crate::_Wrappers_Compile::Option::None {}, + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) + }, + None => crate::_Wrappers_Compile::Option::None {}, }; - ::std::rc::Rc::new(dafny_value) + ::std::rc::Rc::new(dafny_value) } pub fn ostring_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, - >, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input.Extract(), - ), - ) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some( + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input.Extract(), + ), + ) + } else { + None + } } -pub fn obool_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn obool_to_dafny( + input: &Option, +) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn obool_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn obool_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn olong_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn olong_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn olong_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn blob_to_dafny( - input: &::aws_smithy_types::Blob, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) +pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) } pub fn oblob_to_dafny( - input: &Option<::aws_smithy_types::Blob>, + input: &Option<::aws_smithy_types::Blob>, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: blob_to_dafny(&b), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { + value: blob_to_dafny(&b), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn blob_from_dafny( - input: ::dafny_runtime::Sequence, -) -> ::aws_smithy_types::Blob { - - ::aws_smithy_types::Blob::new( - ::std::rc::Rc::try_unwrap(input.to_array()) - .unwrap_or_else(|rc| (*rc).clone()), - ) +pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { + ::aws_smithy_types::Blob::new( + ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), + ) } pub fn oblob_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option<::aws_smithy_types::Blob> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(blob_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(blob_from_dafny(input.Extract())) + } else { + None + } } -pub fn double_to_dafny( - input: f64, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( - &f64::to_be_bytes(input).to_vec(), - |x| *x) +pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( + &f64::to_be_bytes(input).to_vec(), + |x| *x, + ) } pub fn odouble_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: double_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: double_to_dafny(*f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn double_from_dafny( - input: &::dafny_runtime::Sequence, -) -> f64 { - let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); - f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) +pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { + let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); + f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) } pub fn odouble_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(double_from_dafny(&input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(double_from_dafny(&input.Extract())) + } else { + None + } } pub fn timestamp_to_dafny( - input: ::aws_smithy_types::DateTime, + input: &::aws_smithy_types::DateTime, ) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&input.to_string()) + ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &input.to_string(), + ) } pub fn otimestamp_to_dafny( - input: &Option<::aws_smithy_types::DateTime>, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: timestamp_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + input: &Option<::aws_smithy_types::DateTime>, +) -> ::std::rc::Rc< + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, +> { + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: timestamp_to_dafny(f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn timestamp_from_dafny( - input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, ) -> ::aws_smithy_types::DateTime { - let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&input); - ::aws_smithy_types::DateTime::from_str( - &s, - aws_smithy_types::date_time::Format::DateTime, - ).unwrap() + let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input, + ); + ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) + .unwrap() } pub fn otimestamp_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option<::aws_smithy_types::DateTime> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(timestamp_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(timestamp_from_dafny(input.Extract())) + } else { + None + } } pub fn option_from_dafny( - input: ::std::rc::Rc>, - converter: fn(&T) -> TR, + input: ::std::rc::Rc>, + converter: fn(&T) -> TR, ) -> Option { - match &*input { - crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), - crate::_Wrappers_Compile::Option::None { } => None, - } + match &*input { + crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), + crate::_Wrappers_Compile::Option::None {} => None, + } } pub fn option_to_dafny( - input: &Option, - converter: fn(&TR) -> T, + input: &Option, + converter: fn(&TR) -> T, ) -> ::std::rc::Rc> { - match input { - Some(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::Some { - value: converter(&value) - } - ), - None => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::None {} - ), - } + match input { + Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { + value: converter(&value), + }), + None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), + } } pub fn result_from_dafny( - input: ::std::rc::Rc>, - converter_t: fn(&T) -> TR, - converter_e: fn(&E) -> ER, + input: ::std::rc::Rc>, + converter_t: fn(&T) -> TR, + converter_e: fn(&E) -> ER, ) -> Result { - match &*input { - crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), - crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), - } + match &*input { + crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), + crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), + } } pub fn result_to_dafny( - input: &Result, - converter_t: fn(&TR) -> T, - converter_e: fn(&ER) -> E, + input: &Result, + converter_t: fn(&TR) -> T, + converter_e: fn(&ER) -> E, ) -> ::std::rc::Rc> { - match input { - Ok(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: converter_t(&value) - } - ), - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: converter_e(&error) - } - ), - } -} \ No newline at end of file + match input { + Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { + value: converter_t(&value), + }), + Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { + error: converter_e(&error), + }), + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/standard_library_externs.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types.rs index de3910120..0f9d2788b 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types.rs @@ -1,5 +1,8 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -/// Types for the `SimpleIntegerConfig` +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +/// Types for the `SimpleEnumConfig` pub mod simple_enum_config; -pub mod simple_enum_shape; + +mod _simple_enum_shape; +pub use crate::types::_simple_enum_shape::SimpleEnumShape; diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/_simple_enum_shape.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/_simple_enum_shape.rs new file mode 100644 index 000000000..fd2b3fdce --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/_simple_enum_shape.rs @@ -0,0 +1,19 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[derive(Debug, PartialEq, Copy, Clone)] +pub enum SimpleEnumShape { + First, +Second, +Third, +} + +impl ::std::fmt::Display for SimpleEnumShape { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + SimpleEnumShape::First => write!(f, "FIRST"), +SimpleEnumShape::Second => write!(f, "SECOND"), +SimpleEnumShape::Third => write!(f, "THIRD"), + } + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_config.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_config.rs index fd3ea0e14..7fd6368cb 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_config.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_config.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct SimpleEnumConfig {} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_shape.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_shape.rs deleted file mode 100644 index dba314059..000000000 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_shape.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[derive(Debug, PartialEq, Copy, Clone)] -pub enum SimpleEnumShape { - FIRST, - SECOND, - THIRD, -} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/wrapped.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/wrapped.rs new file mode 100644 index 000000000..fe5929068 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/wrapped.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod client; + +impl crate::r#simple::types::smithyenum::internaldafny::wrapped::_default { + pub fn WrappedSimpleEnum(config: &::std::rc::Rc< + crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumConfig, + >) -> ::std::rc::Rc, + ::std::rc::Rc + >>{ + crate::wrapped::client::Client::from_conf(config) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/wrapped/client.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/wrapped/client.rs new file mode 100644 index 000000000..d35f39e8c --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/wrapped/client.rs @@ -0,0 +1,179 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use tokio::runtime::Runtime; + +pub struct Client { + wrapped: crate::client::Client, + + /// A `current_thread` runtime for executing operations on the + /// asynchronous client in a blocking manner. + rt: Runtime +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn crate::r#simple::types::smithyenum::internaldafny::types::ISimpleTypesEnumClient); +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); +} + +impl Client { + pub fn from_conf(config: &::std::rc::Rc< + crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumConfig, + >) -> +::std::rc::Rc, + ::std::rc::Rc +>> { + let rt_result = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build(); + let rt = match rt_result { + Ok(x) => x, + Err(error) => return crate::conversions::error::to_opaque_error_result(error), + }; + let result = crate::client::Client::from_conf( + crate::conversions::simple_enum_config::_simple_enum_config::from_dafny( + config.clone(), + ), + ); + match result { + Ok(client) => { + let wrap = crate::wrapped::client::Client { + wrapped: client, + rt + }; + std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(wrap)) + } + ) + }, + Err(error) => crate::conversions::error::to_opaque_error_result(error) + } + } +} + +impl crate::r#simple::types::smithyenum::internaldafny::types::ISimpleTypesEnumClient for Client { + fn GetEnum( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_enum::_get_enum_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_enum::GetEnum::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_enum::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_enum::_get_enum_output::to_dafny(client), + }, + ), + } + } + + fn GetEnumFirstKnownValueTest( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_enum_first_known_value_test::_get_enum_first_known_value_test_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTest::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_enum_first_known_value_test::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_enum_first_known_value_test::_get_enum_first_known_value_test_output::to_dafny(client), + }, + ), + } + } + + fn GetEnumSecondKnownValueTest( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_enum_second_known_value_test::_get_enum_second_known_value_test_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTest::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_enum_second_known_value_test::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_enum_second_known_value_test::_get_enum_second_known_value_test_output::to_dafny(client), + }, + ), + } + } + + fn GetEnumThirdKnownValueTest( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::smithyenum::internaldafny::types::GetEnumInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::smithyenum::internaldafny::types::GetEnumOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_enum_third_known_value_test::_get_enum_third_known_value_test_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTest::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_enum_third_known_value_test::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_enum_third_known_value_test::_get_enum_third_known_value_test_output::to_dafny(client), + }, + ), + } + } +} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/tests/simple_enum_test.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/tests/simple_enum_test.rs index 8e53533ea..0e8259e73 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/tests/simple_enum_test.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/tests/simple_enum_test.rs @@ -1,48 +1,48 @@ -use simple_enum::types::simple_enum_shape::SimpleEnumShape::*; +use simple_enum::types::SimpleEnumShape::*; use simple_enum::*; #[tokio::test] async fn test_get_enum() { - let result = client().get_enum().value(SECOND).send().await; + let result = client().get_enum().value(Second).send().await; let output = result.unwrap(); let value = output.value().unwrap(); - assert_eq!(value, SECOND); + assert_eq!(value, Second); } #[tokio::test] async fn test_get_first_known_value() { let result = client() .get_enum_first_known_value_test() - .value(FIRST) + .value(First) .send() .await; let output = result.unwrap(); let value = output.value().unwrap(); - assert_eq!(value, FIRST); + assert_eq!(value, First); } #[tokio::test] async fn test_get_second_known_value() { let result = client() .get_enum_second_known_value_test() - .value(SECOND) + .value(Second) .send() .await; let output = result.unwrap(); let value = output.value().unwrap(); - assert_eq!(value, SECOND); + assert_eq!(value, Second); } #[tokio::test] async fn test_get_third_known_value() { let result = client() .get_enum_third_known_value_test() - .value(THIRD) + .value(Third) .send() .await; let output = result.unwrap(); let value = output.value().unwrap(); - assert_eq!(value, THIRD); + assert_eq!(value, Third); } pub fn client() -> Client { diff --git a/TestModels/SimpleTypes/SimpleEnumV2/Makefile b/TestModels/SimpleTypes/SimpleEnumV2/Makefile index c7a5acd8a..bdb7b0e58 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/Makefile +++ b/TestModels/SimpleTypes/SimpleEnumV2/Makefile @@ -3,8 +3,9 @@ CORES=2 +TRANSPILE_TESTS_IN_RUST=1 + ENABLE_EXTERN_PROCESSING=1 -RUST_BENERATED=1 include ../../SharedMakefile.mk diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/Cargo.toml b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/Cargo.toml index dbaad13bf..291c1fd91 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/Cargo.toml +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/Cargo.toml @@ -5,13 +5,19 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +wrapped-client = [] + [dependencies] aws-smithy-runtime = {version = "1.6.0", features = ["client"] } aws-smithy-runtime-api = {version = "1.7.0", features = ["client"] } aws-smithy-types = "1.2.0" dafny_runtime = { path = "../../../../dafny-dependencies/dafny_runtime_rust"} -[dev-dependencies.tokio] +[dev-dependencies] +simple_enum_v2 = { path = ".", features = ["wrapped-client"] } + +[dependencies.tokio] version = "1.26.0" features = ["full"] diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client.rs index f7bbdbfac..83490767c 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use aws_smithy_types::error::operation::BuildError; #[derive(::std::clone::Clone, ::std::fmt::Debug)] @@ -29,7 +30,7 @@ impl Client { )); } Ok(Self { - dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), + dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) }) } } @@ -37,5 +38,7 @@ impl Client { mod get_enum_v2; mod get_enum_v2_first_known_value_test; + mod get_enum_v2_second_known_value_test; + mod get_enum_v2_third_known_value_test; diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2.rs index c9a688bd8..7cc559b93 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2.rs @@ -1,11 +1,13 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { /// Constructs a fluent builder for the [`GetEnumV2`](crate::operation::get_enum_v2::builders::GetEnumV2FluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(SimpleEnumV2Shape)`](crate::operation::get_enum_v2::builders::GetEnumV2FluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_v2::builders::GetEnumV2FluentBuilder::set_value):(undocumented)
+ /// - [`value(impl Into>)`](crate::operation::get_enum_v2::builders::GetEnumV2FluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_v2::builders::GetEnumV2FluentBuilder::set_value): (undocumented)
/// - On success, responds with [`GetEnumV2Output`](crate::operation::get_enum_v2::GetEnumV2Output) with field(s): - /// - [`value(Option)`](crate::operation::get_enum_v2::GetEnumV2Output::value): (undocumented) + /// - [`value(Option)`](crate::operation::get_enum_v2::GetEnumV2Output::value): (undocumented) /// - On failure, responds with [`SdkError`](crate::operation::get_enum_v2::GetEnumV2Error) pub fn get_enum_v2(&self) -> crate::operation::get_enum_v2::builders::GetEnumV2FluentBuilder { crate::operation::get_enum_v2::builders::GetEnumV2FluentBuilder::new(self.clone()) diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_first_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_first_known_value_test.rs index ebde767b2..896b40470 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_first_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_first_known_value_test.rs @@ -1,18 +1,15 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { - /// Constructs a fluent builder for the [`GetEnumV2`](crate::operation::get_enum_v2_first_known_value::builders::GetEnumV2FluentBuilder) operation. + /// Constructs a fluent builder for the [`GetEnumV2FirstKnownValueTest`](crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(SimpleEnumV2Shape)`](crate::operation::get_enum_v2_first_known_value::builders::GetEnumV2FluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_v2_first_known_value::builders::GetEnumV2FluentBuilder::set_value):(undocumented)
- /// - On success, responds with [`GetEnumV2Output`](crate::operation::get_enum_v2_first_known_value::GetEnumV2Output) with field(s): - /// - [`value(Option)`](crate::operation::get_enum_v2_first_known_value::GetEnumV2Output::value): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::get_enum_v2_first_known_value::GetEnumV2Error) - pub fn get_enum_v2_first_known_value_test( - &self, - ) -> crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestFluentBuilder - { - crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestFluentBuilder::new( - self.clone(), - ) + /// - [`value(impl Into>)`](crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestFluentBuilder::set_value): (undocumented)
+ /// - On success, responds with [`GetEnumV2Output`](crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Output) with field(s): + /// - [`value(Option)`](crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Output::value): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestError) + pub fn get_enum_v2_first_known_value_test(&self) -> crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestFluentBuilder { + crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestFluentBuilder::new(self.clone()) } } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_second_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_second_known_value_test.rs index f4981c29d..3bbcda3c1 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_second_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_second_known_value_test.rs @@ -1,18 +1,15 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { - /// Constructs a fluent builder for the [`GetEnumV2`](crate::operation::get_enum_v2_second_known_value::builders::GetEnumV2FluentBuilder) operation. + /// Constructs a fluent builder for the [`GetEnumV2SecondKnownValueTest`](crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(SimpleEnumV2Shape)`](crate::operation::get_enum_v2_second_known_value::builders::GetEnumV2FluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_v2_second_known_value::builders::GetEnumV2FluentBuilder::set_value):(undocumented)
- /// - On success, responds with [`GetEnumV2Output`](crate::operation::get_enum_v2_second_known_value::GetEnumV2Output) with field(s): - /// - [`value(Option)`](crate::operation::get_enum_v2_second_known_value::GetEnumV2Output::value): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::get_enum_v2_second_known_value::GetEnumV2Error) - pub fn get_enum_v2_second_known_value_test( - &self, - ) -> crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestFluentBuilder - { - crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestFluentBuilder::new( - self.clone(), - ) + /// - [`value(impl Into>)`](crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestFluentBuilder::set_value): (undocumented)
+ /// - On success, responds with [`GetEnumV2Output`](crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Output) with field(s): + /// - [`value(Option)`](crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Output::value): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestError) + pub fn get_enum_v2_second_known_value_test(&self) -> crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestFluentBuilder { + crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestFluentBuilder::new(self.clone()) } } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_third_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_third_known_value_test.rs index afc875f37..c37fe8c75 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_third_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_third_known_value_test.rs @@ -1,18 +1,15 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { - /// Constructs a fluent builder for the [`GetEnumV2`](crate::operation::get_enum_v2_third_known_value::builders::GetEnumV2FluentBuilder) operation. + /// Constructs a fluent builder for the [`GetEnumV2ThirdKnownValueTest`](crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(SimpleEnumV2Shape)`](crate::operation::get_enum_v2_third_known_value::builders::GetEnumV2FluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_v2_third_known_value::builders::GetEnumV2FluentBuilder::set_value):(undocumented)
- /// - On success, responds with [`GetEnumV2Output`](crate::operation::get_enum_v2_third_known_value::GetEnumV2Output) with field(s): - /// - [`value(Option)`](crate::operation::get_enum_v2_third_known_value::GetEnumV2Output::value): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::get_enum_v2_third_known_value::GetEnumV2Error) - pub fn get_enum_v2_third_known_value_test( - &self, - ) -> crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestFluentBuilder - { - crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestFluentBuilder::new( - self.clone(), - ) + /// - [`value(impl Into>)`](crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestFluentBuilder::set_value): (undocumented)
+ /// - On success, responds with [`GetEnumV2Output`](crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Output) with field(s): + /// - [`value(Option)`](crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Output::value): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestError) + pub fn get_enum_v2_third_known_value_test(&self) -> crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestFluentBuilder { + crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestFluentBuilder::new(self.clone()) } } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions.rs index 323761ef2..ae84ee4f2 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions.rs @@ -1,9 +1,16 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub mod get_enum_v2; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod error; -pub mod get_enum_v2_first_known_value_test; -pub mod get_enum_v2_second_known_value_test; -pub mod get_enum_v2_third_known_value_test; + pub mod get_enum_v2; -pub mod simple_enum_v2_config; -pub mod simple_enum_v2_shape; + pub mod get_enum_v2_first_known_value_test; + + pub mod get_enum_v2_second_known_value_test; + + pub mod get_enum_v2_third_known_value_test; + + pub mod simple_enum_v2_config; + + pub mod simple_enum_v2_shape; diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/error.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/error.rs new file mode 100644 index 000000000..fd8f69459 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/error.rs @@ -0,0 +1,32 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + /// Wraps up an arbitrary Rust Error value as a Dafny Error +pub fn to_opaque_error(value: E) -> + ::std::rc::Rc +{ + let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( + ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), + )); + ::std::rc::Rc::new( + crate::r#simple::types::enumv2::internaldafny::types::Error::Opaque { + obj: error_obj, + }, + ) +} + +/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure +pub fn to_opaque_error_result(value: E) -> + ::std::rc::Rc< + crate::_Wrappers_Compile::Result< + T, + ::std::rc::Rc + > + > +{ + ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: to_opaque_error(value), + }, + ) +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2.rs index e9b9909b5..b6ad1638f 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] @@ -7,14 +8,9 @@ pub fn to_dafny_error( value: crate::operation::get_enum_v2::GetEnumV2Error, ) -> ::std::rc::Rc { match value { - crate::operation::get_enum_v2::GetEnumV2Error::Unhandled(unhandled) => ::std::rc::Rc::new( - crate::r#simple::types::enumv2::internaldafny::types::Error::Opaque { - obj: ::dafny_runtime::upcast_object()( - ::dafny_runtime::object::new(unhandled), - ), - }, - ), - } + crate::operation::get_enum_v2::GetEnumV2Error::Unhandled(unhandled) => + ::std::rc::Rc::new(crate::r#simple::types::enumv2::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) + } } #[allow(dead_code)] diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_input.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_input.rs index 236bf3550..00959d1e8 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_input.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_input.rs @@ -1,45 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_enum_v2::GetEnumV2Input, ) -> ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::to_dafny(&v), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input::GetEnumV2Input { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_v2_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input, >, ) -> crate::operation::get_enum_v2::GetEnumV2Input { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_v2::GetEnumV2Input { value } + crate::operation::get_enum_v2::GetEnumV2Input::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_v2_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_output.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_output.rs index 84d950d91..08130c3e9 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_output.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_output.rs @@ -1,45 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_enum_v2::GetEnumV2Output, ) -> ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output, -> { - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::to_dafny(&b), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output::GetEnumV2Output { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_v2_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output, >, ) -> crate::operation::get_enum_v2::GetEnumV2Output { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_v2::GetEnumV2Output { value } + crate::operation::get_enum_v2::GetEnumV2Output::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_v2_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test.rs index 9e8509446..e7bfe032d 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs index 043d69333..96fe41e22 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs @@ -1,47 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestInput, + value: crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Input, ) -> ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::to_dafny(&v), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input::GetEnumV2Input { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_v2_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input, >, -) -> crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestInput { - value, - } +) -> crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Input { + crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Input::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_v2_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs index 7378e1178..268a2afa6 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs @@ -1,47 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestOutput, + value: crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Output, ) -> ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output, -> { - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::to_dafny(&b), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output::GetEnumV2Output { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_v2_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output, >, -) -> crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestOutput { - value, - } +) -> crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Output { + crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Output::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_v2_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test.rs index b6de63fad..e64c31505 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs index a7a40bf49..74e95d15a 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs @@ -1,47 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestInput, + value: crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Input, ) -> ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::to_dafny(&v), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input::GetEnumV2Input { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_v2_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input, >, -) -> crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestInput { - value, - } +) -> crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Input { + crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Input::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_v2_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs index 07bec2664..0b6841011 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs @@ -1,47 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestOutput, + value: crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Output, ) -> ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output, -> { - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::to_dafny(&b), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output::GetEnumV2Output { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_v2_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output, >, -) -> crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestOutput { - value, - } +) -> crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Output { + crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Output::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_v2_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test.rs index a1ddd7dab..d190f0907 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs index 8adc054b0..1b60f1e57 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs @@ -1,47 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestInput, + value: crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Input, ) -> ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::to_dafny(&v), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input::GetEnumV2Input { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_v2_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input, >, -) -> crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestInput { - value, - } +) -> crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Input { + crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Input::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_v2_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs index 1607c8003..ca7d68c38 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs @@ -1,47 +1,34 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestOutput, + value: crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Output, ) -> ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output, -> { - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::to_dafny(&b), - ), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output::GetEnumV2Output { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match &value.value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::simple_enum_v2_shape::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output, >, -) -> crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - crate::conversions::simple_enum_v2_shape::_simple_enum_v2_shape::from_dafny( - &*dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestOutput { - value, - } +) -> crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Output { + crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Output::builder() + .set_value(match &**dafny_value.value() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::simple_enum_v2_shape::from_dafny(value) + ), + _ => None, +} +) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config.rs index 3eaacd610..e280adea2 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config.rs @@ -1,3 +1,4 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub mod _simple_enum_v2_config; diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config/_simple_enum_v2_config.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config/_simple_enum_v2_config.rs index f0a680451..005e3ea6e 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config/_simple_enum_v2_config.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config/_simple_enum_v2_config.rs @@ -1,10 +1,12 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::types::simple_enum_v2_config::SimpleEnumV2Config, ) -> ::std::rc::Rc< - crate::simple::types::enumv2::internaldafny::types::SimpleEnumV2Config, + crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Config, > { ::std::rc::Rc::new(crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Config::SimpleEnumV2Config {}) } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape.rs index b4f4a50f8..d2e61a367 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape.rs @@ -1,3 +1,25 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] -pub mod _simple_enum_v2_shape; +pub fn to_dafny( + value: crate::types::SimpleEnumV2Shape, +) -> ::std::rc::Rc{ + ::std::rc::Rc::new(match value { + crate::types::SimpleEnumV2Shape::First => crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape::FIRST {}, +crate::types::SimpleEnumV2Shape::Second => crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape::SECOND {}, +crate::types::SimpleEnumV2Shape::Third => crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape::THIRD {}, + _ => panic!("Unknown enum variant: {}", value), + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: &crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape, +) -> crate::types::SimpleEnumV2Shape { + match dafny_value { + crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape::FIRST {} => crate::types::SimpleEnumV2Shape::First, +crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape::SECOND {} => crate::types::SimpleEnumV2Shape::Second, +crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape::THIRD {} => crate::types::SimpleEnumV2Shape::Third, + } +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape/_simple_enum_v2_shape.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape/_simple_enum_v2_shape.rs deleted file mode 100644 index d48a6337b..000000000 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape/_simple_enum_v2_shape.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(dead_code)] - -pub fn to_dafny( - value: &crate::types::simple_enum_v2_shape::SimpleEnumV2Shape, -) -> crate::simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape { - match value { - crate::types::simple_enum_v2_shape::SimpleEnumV2Shape::FIRST => crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape::FIRST {}, - crate::types::simple_enum_v2_shape::SimpleEnumV2Shape::SECOND => crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape::SECOND {}, - crate::types::simple_enum_v2_shape::SimpleEnumV2Shape::THIRD => crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape::THIRD {}, - } -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape, -) -> crate::types::simple_enum_v2_shape::SimpleEnumV2Shape { - match dafny_value { - crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape::FIRST {} => crate::types::simple_enum_v2_shape::SimpleEnumV2Shape::FIRST, - crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape::SECOND {} => crate::types::simple_enum_v2_shape::SimpleEnumV2Shape::SECOND, - crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Shape::THIRD {} => crate::types::simple_enum_v2_shape::SimpleEnumV2Shape::THIRD, - } -} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error.rs index ec89cbecc..4cddaa7c3 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use ::aws_smithy_runtime_api::box_error::BoxError; /// Error type returned by the client. diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error/sealed_unhandled.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error/sealed_unhandled.rs index cce22d1cf..eae800729 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error/sealed_unhandled.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error/sealed_unhandled.rs @@ -1,4 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::any::Any; + +use dafny_runtime::UpcastObject; + /// This struct is not intended to be used. /// /// This struct holds information about an unhandled error, @@ -21,6 +27,6 @@ pub struct Unhandled { pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, } -impl ::dafny_runtime::UpcastObject for Unhandled { +impl UpcastObject for Unhandled { ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/lib.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/lib.rs deleted file mode 100644 index fcb015ba3..000000000 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/lib.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![allow(deprecated)] - -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -pub mod client; -pub mod types; - -/// Common errors and error handling utilities. -pub mod error; - -/// All operations that this crate can perform. -pub mod operation; - -mod conversions; - -pub mod implementation_from_dafny; - -pub use client::Client; -pub use types::simple_enum_v2_config::SimpleEnumV2Config; diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation.rs index 565298a1a..a4dc395b8 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation.rs @@ -1,9 +1,14 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `GetEnumV2` operation. pub mod get_enum_v2; -/// Types for the `GetEnumV2KnownValue` operation. +/// Types for the `GetEnumV2FirstKnownValueTest` operation. pub mod get_enum_v2_first_known_value_test; + +/// Types for the `GetEnumV2SecondKnownValueTest` operation. pub mod get_enum_v2_second_known_value_test; + +/// Types for the `GetEnumV2ThirdKnownValueTest` operation. pub mod get_enum_v2_third_known_value_test; diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2.rs index f556fbe3e..d35d560f1 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetEnumV2`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -137,9 +139,9 @@ pub use crate::operation::get_enum_v2::_get_enum_v2_output::GetEnumV2Output; pub use crate::operation::get_enum_v2::_get_enum_v2_input::GetEnumV2Input; -mod _get_enum_v2_input; +pub(crate) mod _get_enum_v2_output; -mod _get_enum_v2_output; +pub(crate) mod _get_enum_v2_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_input.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_input.rs index a84202268..dfb86df68 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_input.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_input.rs @@ -1,19 +1,18 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetEnumV2Input { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, +pub value: ::std::option::Option, } impl GetEnumV2Input { #[allow(missing_docs)] // documentation missing in model - pub fn message( - &self, - ) -> ::std::option::Option<&crate::types::simple_enum_v2_shape::SimpleEnumV2Shape> { - self.value.as_ref() - } +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} } impl GetEnumV2Input { /// Creates a new builder-style object to manufacture [`GetEnumV2Input`](crate::operation::operation::GetEnumV2Input). @@ -28,31 +27,23 @@ impl GetEnumV2Input { ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, )] pub struct GetEnumV2InputBuilder { - pub(crate) value: ::std::option::Option, + pub(crate) value: ::std::option::Option, } impl GetEnumV2InputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} /// Consumes the builder and constructs a [`GetEnumV2Input`](crate::operation::operation::GetEnumV2Input). pub fn build( self, diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_output.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_output.rs index 002769f65..3037a73e7 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_output.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_output.rs @@ -1,22 +1,19 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetEnumV2Output { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, +pub value: ::std::option::Option, } - impl GetEnumV2Output { #[allow(missing_docs)] // documentation missing in model - pub fn value( - &self, - ) -> ::std::option::Option { - self.value - } +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} } - impl GetEnumV2Output { /// Creates a new builder-style object to manufacture [`GetEnumV2Output`](crate::operation::operation::GetEnumV2Output). pub fn builder() -> crate::operation::get_enum_v2::builders::GetEnumV2OutputBuilder { @@ -30,35 +27,23 @@ impl GetEnumV2Output { ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, )] pub struct GetEnumV2OutputBuilder { - pub(crate) value: ::std::option::Option, + pub(crate) value: ::std::option::Option, } - impl GetEnumV2OutputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} /// Consumes the builder and constructs a [`GetEnumV2Output`](crate::operation::operation::GetEnumV2Output). pub fn build( self, diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/builders.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/builders.rs index e742b3d97..89b6e6ef1 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/builders.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/builders.rs @@ -1,7 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_enum_v2::_get_enum_v2_input::GetEnumV2InputBuilder; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use crate::operation::get_enum_v2::_get_enum_v2_output::GetEnumV2OutputBuilder; +pub use crate::operation::get_enum_v2::_get_enum_v2_input::GetEnumV2InputBuilder; + impl GetEnumV2InputBuilder { /// Sends a request with this input using the given client. pub async fn send_with( @@ -21,7 +24,7 @@ impl GetEnumV2InputBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetEnumV2FluentBuilder { client: crate::client::Client, - inner: crate::operation::get_enum_v2::builders::GetEnumV2InputBuilder, + pub(crate) inner: crate::operation::get_enum_v2::builders::GetEnumV2InputBuilder, } impl GetEnumV2FluentBuilder { /// Creates a new `GetEnumV2`. @@ -55,22 +58,17 @@ impl GetEnumV2FluentBuilder { } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: crate::types::simple_enum_v2_shape::SimpleEnumV2Shape) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test.rs index 57c67e00b..eae709de4 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetEnumV2FirstKnownValueTest`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -10,15 +12,14 @@ impl GetEnumV2FirstKnownValueTest { } pub(crate) async fn send( client: &crate::client::Client, - input: crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestInput, + input: crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Input, ) -> ::std::result::Result< - crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestOutput, + crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Output, crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestError, > { - let inner_input = - crate::conversions::get_enum_v2_first_known_value_test::_get_enum_v2_first_known_value_test_input::to_dafny(input); + let inner_input = crate::conversions::get_enum_v2_first_known_value_test::_get_enum_v2_first_known_value_test_input::to_dafny(input); let inner_result = - ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumV2(&inner_input); + ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumV2FirstKnownValueTest(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } @@ -29,11 +30,9 @@ impl GetEnumV2FirstKnownValueTest { ), ) } else { - Err( - crate::conversions::get_enum_v2_first_known_value_test::from_dafny_error( - inner_result.error().clone(), - ), - ) + Err(crate::conversions::get_enum_v2_first_known_value_test::from_dafny_error( + inner_result.error().clone(), + )) } } } @@ -42,7 +41,7 @@ impl GetEnumV2FirstKnownValueTest { #[non_exhaustive] #[derive(::std::fmt::Debug)] pub enum GetEnumV2FirstKnownValueTestError { - /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unfirst_known error code). + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). #[deprecated( note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ variable wildcard pattern and check `.code()`: @@ -115,18 +114,14 @@ impl ::aws_smithy_types::retry::ProvideErrorKind for GetEnumV2FirstKnownValueTes ::std::option::Option::None } } -impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata - for GetEnumV2FirstKnownValueTestError -{ +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetEnumV2FirstKnownValueTestError { fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { match self { Self::Unhandled(_inner) => &_inner.meta, } } } -impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError - for GetEnumV2FirstKnownValueTestError -{ +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetEnumV2FirstKnownValueTestError { fn create_unhandled_error( source: ::std::boxed::Box< dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, @@ -140,13 +135,13 @@ impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError } } -pub use crate::operation::get_enum_v2_first_known_value_test::_get_enum_v2_first_known_value_test_output::GetEnumV2FirstKnownValueTestOutput; +pub use crate::operation::get_enum_v2_first_known_value_test::_get_enum_v2_output::GetEnumV2Output; -pub use crate::operation::get_enum_v2_first_known_value_test::_get_enum_v2_first_known_value_test_input::GetEnumV2FirstKnownValueTestInput; +pub use crate::operation::get_enum_v2_first_known_value_test::_get_enum_v2_input::GetEnumV2Input; -mod _get_enum_v2_first_known_value_test_input; +pub(crate) mod _get_enum_v2_output; -mod _get_enum_v2_first_known_value_test_output; +pub(crate) mod _get_enum_v2_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs deleted file mode 100644 index a367fd776..000000000 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetEnumV2FirstKnownValueTestInput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetEnumV2FirstKnownValueTestInput { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - &self, - ) -> ::std::option::Option { - self.value - } -} -impl GetEnumV2FirstKnownValueTestInput { - /// Creates a new builder-style object to manufacture [`GetEnumV2FirstKnownValueTestInput`](crate::operation::operation::GetEnumV2FirstKnownValueTestInput). - pub fn builder( - ) -> crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestInputBuilder - { - crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestInputBuilder::default() - } -} - -/// A builder for [`GetEnumV2FirstKnownValueTestInput`](crate::operation::operation::GetEnumV2FirstKnownValueTestInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetEnumV2FirstKnownValueTestInputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetEnumV2FirstKnownValueTestInputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetEnumV2FirstKnownValueTestInput`](crate::operation::operation::GetEnumV2FirstKnownValueTestInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestInput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs deleted file mode 100644 index f665704ab..000000000 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetEnumV2FirstKnownValueTestOutput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetEnumV2FirstKnownValueTestOutput { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - &self, - ) -> ::std::option::Option { - self.value - } -} -impl GetEnumV2FirstKnownValueTestOutput { - /// Creates a new builder-style object to manufacture [`GetEnumV2FirstKnownValueTestOutput`](crate::operation::operation::GetEnumV2FirstKnownValueTestOutput). - pub fn builder( - ) -> crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestOutputBuilder - { - crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestOutputBuilder::default() - } -} - -/// A builder for [`GetEnumV2FirstKnownValueTestOutput`](crate::operation::operation::GetEnumV2FirstKnownValueTestOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetEnumV2FirstKnownValueTestOutputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetEnumV2FirstKnownValueTestOutputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetEnumV2FirstKnownValueTestOutput`](crate::operation::operation::GetEnumV2FirstKnownValueTestOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestOutput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_input.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_input.rs new file mode 100644 index 000000000..fab2d07d1 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEnumV2Input { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option, +} +impl GetEnumV2Input { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} +} +impl GetEnumV2Input { + /// Creates a new builder-style object to manufacture [`GetEnumV2Input`](crate::operation::operation::GetEnumV2Input). + pub fn builder() -> crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2InputBuilder { + crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2InputBuilder::default() + } +} + +/// A builder for [`GetEnumV2Input`](crate::operation::operation::GetEnumV2Input). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetEnumV2InputBuilder { + pub(crate) value: ::std::option::Option, +} +impl GetEnumV2InputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} + /// Consumes the builder and constructs a [`GetEnumV2Input`](crate::operation::operation::GetEnumV2Input). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Input, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Input { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_output.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_output.rs new file mode 100644 index 000000000..ee11f4792 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEnumV2Output { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option, +} +impl GetEnumV2Output { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} +} +impl GetEnumV2Output { + /// Creates a new builder-style object to manufacture [`GetEnumV2Output`](crate::operation::operation::GetEnumV2Output). + pub fn builder() -> crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2OutputBuilder { + crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2OutputBuilder::default() + } +} + +/// A builder for [`GetEnumV2Output`](crate::operation::operation::GetEnumV2Output). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetEnumV2OutputBuilder { + pub(crate) value: ::std::option::Option, +} +impl GetEnumV2OutputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} + /// Consumes the builder and constructs a [`GetEnumV2Output`](crate::operation::operation::GetEnumV2Output). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Output, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Output { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/builders.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/builders.rs index c88ff6efe..548fdeb7d 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/builders.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/builders.rs @@ -1,14 +1,17 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_enum_v2_first_known_value_test::_get_enum_v2_first_known_value_test_input::GetEnumV2FirstKnownValueTestInputBuilder; -pub use crate::operation::get_enum_v2_first_known_value_test::_get_enum_v2_first_known_value_test_output::GetEnumV2FirstKnownValueTestOutputBuilder; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::get_enum_v2_first_known_value_test::_get_enum_v2_output::GetEnumV2OutputBuilder; -impl GetEnumV2FirstKnownValueTestInputBuilder { +pub use crate::operation::get_enum_v2_first_known_value_test::_get_enum_v2_input::GetEnumV2InputBuilder; + +impl GetEnumV2InputBuilder { /// Sends a request with this input using the given client. pub async fn send_with( self, client: &crate::Client, ) -> ::std::result::Result< - crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestOutput, + crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Output, crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestError, > { let mut fluent_builder = client.get_enum_v2_first_known_value_test(); @@ -21,8 +24,7 @@ impl GetEnumV2FirstKnownValueTestInputBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetEnumV2FirstKnownValueTestFluentBuilder { client: crate::client::Client, - inner: - crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestInputBuilder, + pub(crate) inner: crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2InputBuilder, } impl GetEnumV2FirstKnownValueTestFluentBuilder { /// Creates a new `GetEnumV2FirstKnownValueTest`. @@ -33,52 +35,40 @@ impl GetEnumV2FirstKnownValueTestFluentBuilder { } } /// Access the GetEnumV2FirstKnownValueTest as a reference. - pub fn as_input( - &self, - ) -> &crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestInputBuilder - { + pub fn as_input(&self) -> &crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2InputBuilder { &self.inner } /// Sends the request and returns the response. pub async fn send( self, ) -> ::std::result::Result< - crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestOutput, + crate::operation::get_enum_v2_first_known_value_test::GetEnumV2Output, crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestError, > { let input = self .inner .build() - // Using unhandled since GetEnumV2 doesn't declare any validation, + // Using unhandled since GetEnumV2FirstKnownValueTest doesn't declare any validation, // and smithy-rs seems to not generate a ValidationError case unless there is // (but isn't that a backwards compatibility problem for output structures?) // Vanilla smithy-rs uses SdkError::construction_failure, // but we aren't using SdkError. .map_err(crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestError::unhandled)?; - crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTest::send( - &self.client, - input, - ) - .await + crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTest::send(&self.client, input).await } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: crate::types::simple_enum_v2_shape::SimpleEnumV2Shape) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test.rs index 9fecf26d2..915d3dd2c 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetEnumV2SecondKnownValueTest`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -10,15 +12,14 @@ impl GetEnumV2SecondKnownValueTest { } pub(crate) async fn send( client: &crate::client::Client, - input: crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestInput, + input: crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Input, ) -> ::std::result::Result< - crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestOutput, + crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Output, crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestError, > { - let inner_input = - crate::conversions::get_enum_v2_second_known_value_test::_get_enum_v2_second_known_value_test_input::to_dafny(input); + let inner_input = crate::conversions::get_enum_v2_second_known_value_test::_get_enum_v2_second_known_value_test_input::to_dafny(input); let inner_result = - ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumV2(&inner_input); + ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumV2SecondKnownValueTest(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } @@ -29,11 +30,9 @@ impl GetEnumV2SecondKnownValueTest { ), ) } else { - Err( - crate::conversions::get_enum_v2_second_known_value_test::from_dafny_error( - inner_result.error().clone(), - ), - ) + Err(crate::conversions::get_enum_v2_second_known_value_test::from_dafny_error( + inner_result.error().clone(), + )) } } } @@ -42,7 +41,7 @@ impl GetEnumV2SecondKnownValueTest { #[non_exhaustive] #[derive(::std::fmt::Debug)] pub enum GetEnumV2SecondKnownValueTestError { - /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unsecond_known error code). + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). #[deprecated( note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ variable wildcard pattern and check `.code()`: @@ -115,18 +114,14 @@ impl ::aws_smithy_types::retry::ProvideErrorKind for GetEnumV2SecondKnownValueTe ::std::option::Option::None } } -impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata - for GetEnumV2SecondKnownValueTestError -{ +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetEnumV2SecondKnownValueTestError { fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { match self { Self::Unhandled(_inner) => &_inner.meta, } } } -impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError - for GetEnumV2SecondKnownValueTestError -{ +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetEnumV2SecondKnownValueTestError { fn create_unhandled_error( source: ::std::boxed::Box< dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, @@ -140,13 +135,13 @@ impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError } } -pub use crate::operation::get_enum_v2_second_known_value_test::_get_enum_v2_second_known_value_test_output::GetEnumV2SecondKnownValueTestOutput; +pub use crate::operation::get_enum_v2_second_known_value_test::_get_enum_v2_output::GetEnumV2Output; -pub use crate::operation::get_enum_v2_second_known_value_test::_get_enum_v2_second_known_value_test_input::GetEnumV2SecondKnownValueTestInput; +pub use crate::operation::get_enum_v2_second_known_value_test::_get_enum_v2_input::GetEnumV2Input; -mod _get_enum_v2_second_known_value_test_input; +pub(crate) mod _get_enum_v2_output; -mod _get_enum_v2_second_known_value_test_output; +pub(crate) mod _get_enum_v2_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_input.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_input.rs new file mode 100644 index 000000000..925024a03 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEnumV2Input { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option, +} +impl GetEnumV2Input { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} +} +impl GetEnumV2Input { + /// Creates a new builder-style object to manufacture [`GetEnumV2Input`](crate::operation::operation::GetEnumV2Input). + pub fn builder() -> crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2InputBuilder { + crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2InputBuilder::default() + } +} + +/// A builder for [`GetEnumV2Input`](crate::operation::operation::GetEnumV2Input). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetEnumV2InputBuilder { + pub(crate) value: ::std::option::Option, +} +impl GetEnumV2InputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} + /// Consumes the builder and constructs a [`GetEnumV2Input`](crate::operation::operation::GetEnumV2Input). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Input, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Input { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_output.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_output.rs new file mode 100644 index 000000000..2e6fc555e --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEnumV2Output { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option, +} +impl GetEnumV2Output { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} +} +impl GetEnumV2Output { + /// Creates a new builder-style object to manufacture [`GetEnumV2Output`](crate::operation::operation::GetEnumV2Output). + pub fn builder() -> crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2OutputBuilder { + crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2OutputBuilder::default() + } +} + +/// A builder for [`GetEnumV2Output`](crate::operation::operation::GetEnumV2Output). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetEnumV2OutputBuilder { + pub(crate) value: ::std::option::Option, +} +impl GetEnumV2OutputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} + /// Consumes the builder and constructs a [`GetEnumV2Output`](crate::operation::operation::GetEnumV2Output). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Output, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Output { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs deleted file mode 100644 index d13dfd188..000000000 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetEnumV2SecondKnownValueTestInput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetEnumV2SecondKnownValueTestInput { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - &self, - ) -> ::std::option::Option { - self.value - } -} -impl GetEnumV2SecondKnownValueTestInput { - /// Creates a new builder-style object to manufacture [`GetEnumV2SecondKnownValueTestInput`](crate::operation::operation::GetEnumV2SecondKnownValueTestInput). - pub fn builder( - ) -> crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestInputBuilder - { - crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestInputBuilder::default() - } -} - -/// A builder for [`GetEnumV2SecondKnownValueTestInput`](crate::operation::operation::GetEnumV2SecondKnownValueTestInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetEnumV2SecondKnownValueTestInputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetEnumV2SecondKnownValueTestInputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetEnumV2SecondKnownValueTestInput`](crate::operation::operation::GetEnumV2SecondKnownValueTestInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestInput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs deleted file mode 100644 index 39218e3ad..000000000 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetEnumV2SecondKnownValueTestOutput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetEnumV2SecondKnownValueTestOutput { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - &self, - ) -> ::std::option::Option { - self.value - } -} -impl GetEnumV2SecondKnownValueTestOutput { - /// Creates a new builder-style object to manufacture [`GetEnumV2SecondKnownValueTestOutput`](crate::operation::operation::GetEnumV2SecondKnownValueTestOutput). - pub fn builder( - ) -> crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestOutputBuilder - { - crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestOutputBuilder::default() - } -} - -/// A builder for [`GetEnumV2SecondKnownValueTestOutput`](crate::operation::operation::GetEnumV2SecondKnownValueTestOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetEnumV2SecondKnownValueTestOutputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetEnumV2SecondKnownValueTestOutputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetEnumV2SecondKnownValueTestOutput`](crate::operation::operation::GetEnumV2SecondKnownValueTestOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestOutput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/builders.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/builders.rs index 5137b217e..13b367620 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/builders.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/builders.rs @@ -1,14 +1,17 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_enum_v2_second_known_value_test::_get_enum_v2_second_known_value_test_input::GetEnumV2SecondKnownValueTestInputBuilder; -pub use crate::operation::get_enum_v2_second_known_value_test::_get_enum_v2_second_known_value_test_output::GetEnumV2SecondKnownValueTestOutputBuilder; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::get_enum_v2_second_known_value_test::_get_enum_v2_output::GetEnumV2OutputBuilder; -impl GetEnumV2SecondKnownValueTestInputBuilder { +pub use crate::operation::get_enum_v2_second_known_value_test::_get_enum_v2_input::GetEnumV2InputBuilder; + +impl GetEnumV2InputBuilder { /// Sends a request with this input using the given client. pub async fn send_with( self, client: &crate::Client, ) -> ::std::result::Result< - crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestOutput, + crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Output, crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestError, > { let mut fluent_builder = client.get_enum_v2_second_known_value_test(); @@ -21,7 +24,7 @@ impl GetEnumV2SecondKnownValueTestInputBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetEnumV2SecondKnownValueTestFluentBuilder { client: crate::client::Client, - inner: crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestInputBuilder, + pub(crate) inner: crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2InputBuilder, } impl GetEnumV2SecondKnownValueTestFluentBuilder { /// Creates a new `GetEnumV2SecondKnownValueTest`. @@ -32,52 +35,40 @@ impl GetEnumV2SecondKnownValueTestFluentBuilder { } } /// Access the GetEnumV2SecondKnownValueTest as a reference. - pub fn as_input( - &self, - ) -> &crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestInputBuilder - { + pub fn as_input(&self) -> &crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2InputBuilder { &self.inner } /// Sends the request and returns the response. pub async fn send( self, ) -> ::std::result::Result< - crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestOutput, + crate::operation::get_enum_v2_second_known_value_test::GetEnumV2Output, crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestError, > { let input = self .inner .build() - // Using unhandled since GetEnumV2 doesn't declare any validation, + // Using unhandled since GetEnumV2SecondKnownValueTest doesn't declare any validation, // and smithy-rs seems to not generate a ValidationError case unless there is // (but isn't that a backwards compatibility problem for output structures?) // Vanilla smithy-rs uses SdkError::construction_failure, // but we aren't using SdkError. .map_err(crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestError::unhandled)?; - crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTest::send( - &self.client, - input, - ) - .await + crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTest::send(&self.client, input).await } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: crate::types::simple_enum_v2_shape::SimpleEnumV2Shape) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test.rs index bf5efb30b..188442ad2 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetEnumV2ThirdKnownValueTest`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -10,15 +12,14 @@ impl GetEnumV2ThirdKnownValueTest { } pub(crate) async fn send( client: &crate::client::Client, - input: crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestInput, + input: crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Input, ) -> ::std::result::Result< - crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestOutput, + crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Output, crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestError, > { - let inner_input = - crate::conversions::get_enum_v2_third_known_value_test::_get_enum_v2_third_known_value_test_input::to_dafny(input); + let inner_input = crate::conversions::get_enum_v2_third_known_value_test::_get_enum_v2_third_known_value_test_input::to_dafny(input); let inner_result = - ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumV2(&inner_input); + ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumV2ThirdKnownValueTest(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } @@ -29,11 +30,9 @@ impl GetEnumV2ThirdKnownValueTest { ), ) } else { - Err( - crate::conversions::get_enum_v2_third_known_value_test::from_dafny_error( - inner_result.error().clone(), - ), - ) + Err(crate::conversions::get_enum_v2_third_known_value_test::from_dafny_error( + inner_result.error().clone(), + )) } } } @@ -42,7 +41,7 @@ impl GetEnumV2ThirdKnownValueTest { #[non_exhaustive] #[derive(::std::fmt::Debug)] pub enum GetEnumV2ThirdKnownValueTestError { - /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unthird_known error code). + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). #[deprecated( note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ variable wildcard pattern and check `.code()`: @@ -115,18 +114,14 @@ impl ::aws_smithy_types::retry::ProvideErrorKind for GetEnumV2ThirdKnownValueTes ::std::option::Option::None } } -impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata - for GetEnumV2ThirdKnownValueTestError -{ +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetEnumV2ThirdKnownValueTestError { fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { match self { Self::Unhandled(_inner) => &_inner.meta, } } } -impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError - for GetEnumV2ThirdKnownValueTestError -{ +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetEnumV2ThirdKnownValueTestError { fn create_unhandled_error( source: ::std::boxed::Box< dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, @@ -140,13 +135,13 @@ impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError } } -pub use crate::operation::get_enum_v2_third_known_value_test::_get_enum_v2_third_known_value_test_output::GetEnumV2ThirdKnownValueTestOutput; +pub use crate::operation::get_enum_v2_third_known_value_test::_get_enum_v2_output::GetEnumV2Output; -pub use crate::operation::get_enum_v2_third_known_value_test::_get_enum_v2_third_known_value_test_input::GetEnumV2ThirdKnownValueTestInput; +pub use crate::operation::get_enum_v2_third_known_value_test::_get_enum_v2_input::GetEnumV2Input; -mod _get_enum_v2_third_known_value_test_input; +pub(crate) mod _get_enum_v2_output; -mod _get_enum_v2_third_known_value_test_output; +pub(crate) mod _get_enum_v2_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_input.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_input.rs new file mode 100644 index 000000000..cdfce6ed4 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEnumV2Input { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option, +} +impl GetEnumV2Input { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} +} +impl GetEnumV2Input { + /// Creates a new builder-style object to manufacture [`GetEnumV2Input`](crate::operation::operation::GetEnumV2Input). + pub fn builder() -> crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2InputBuilder { + crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2InputBuilder::default() + } +} + +/// A builder for [`GetEnumV2Input`](crate::operation::operation::GetEnumV2Input). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetEnumV2InputBuilder { + pub(crate) value: ::std::option::Option, +} +impl GetEnumV2InputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} + /// Consumes the builder and constructs a [`GetEnumV2Input`](crate::operation::operation::GetEnumV2Input). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Input, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Input { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_output.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_output.rs new file mode 100644 index 000000000..1799bb2d2 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEnumV2Output { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option, +} +impl GetEnumV2Output { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option { + self.value.clone() +} +} +impl GetEnumV2Output { + /// Creates a new builder-style object to manufacture [`GetEnumV2Output`](crate::operation::operation::GetEnumV2Output). + pub fn builder() -> crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2OutputBuilder { + crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2OutputBuilder::default() + } +} + +/// A builder for [`GetEnumV2Output`](crate::operation::operation::GetEnumV2Output). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetEnumV2OutputBuilder { + pub(crate) value: ::std::option::Option, +} +impl GetEnumV2OutputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + &self.value +} + /// Consumes the builder and constructs a [`GetEnumV2Output`](crate::operation::operation::GetEnumV2Output). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Output, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Output { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs deleted file mode 100644 index 573fb3c14..000000000 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetEnumV2ThirdKnownValueTestInput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetEnumV2ThirdKnownValueTestInput { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - &self, - ) -> ::std::option::Option { - self.value - } -} -impl GetEnumV2ThirdKnownValueTestInput { - /// Creates a new builder-style object to manufacture [`GetEnumV2ThirdKnownValueTestInput`](crate::operation::operation::GetEnumV2ThirdKnownValueTestInput). - pub fn builder( - ) -> crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestInputBuilder - { - crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestInputBuilder::default() - } -} - -/// A builder for [`GetEnumV2ThirdKnownValueTestInput`](crate::operation::operation::GetEnumV2ThirdKnownValueTestInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetEnumV2ThirdKnownValueTestInputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetEnumV2ThirdKnownValueTestInputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetEnumV2ThirdKnownValueTestInput`](crate::operation::operation::GetEnumV2ThirdKnownValueTestInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestInput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs deleted file mode 100644 index 588e636c9..000000000 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetEnumV2ThirdKnownValueTestOutput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetEnumV2ThirdKnownValueTestOutput { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - &self, - ) -> ::std::option::Option { - self.value - } -} -impl GetEnumV2ThirdKnownValueTestOutput { - /// Creates a new builder-style object to manufacture [`GetEnumV2ThirdKnownValueTestOutput`](crate::operation::operation::GetEnumV2ThirdKnownValueTestOutput). - pub fn builder( - ) -> crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestOutputBuilder - { - crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestOutputBuilder::default() - } -} - -/// A builder for [`GetEnumV2ThirdKnownValueTestOutput`](crate::operation::operation::GetEnumV2ThirdKnownValueTestOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetEnumV2ThirdKnownValueTestOutputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetEnumV2ThirdKnownValueTestOutputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value( - mut self, - input: impl ::std::convert::Into, - ) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetEnumV2ThirdKnownValueTestOutput`](crate::operation::operation::GetEnumV2ThirdKnownValueTestOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestOutput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/builders.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/builders.rs index f1bbbe058..84838695d 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/builders.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/builders.rs @@ -1,14 +1,17 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_enum_v2_third_known_value_test::_get_enum_v2_third_known_value_test_input::GetEnumV2ThirdKnownValueTestInputBuilder; -pub use crate::operation::get_enum_v2_third_known_value_test::_get_enum_v2_third_known_value_test_output::GetEnumV2ThirdKnownValueTestOutputBuilder; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::get_enum_v2_third_known_value_test::_get_enum_v2_output::GetEnumV2OutputBuilder; -impl GetEnumV2ThirdKnownValueTestInputBuilder { +pub use crate::operation::get_enum_v2_third_known_value_test::_get_enum_v2_input::GetEnumV2InputBuilder; + +impl GetEnumV2InputBuilder { /// Sends a request with this input using the given client. pub async fn send_with( self, client: &crate::Client, ) -> ::std::result::Result< - crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestOutput, + crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Output, crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestError, > { let mut fluent_builder = client.get_enum_v2_third_known_value_test(); @@ -21,8 +24,7 @@ impl GetEnumV2ThirdKnownValueTestInputBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetEnumV2ThirdKnownValueTestFluentBuilder { client: crate::client::Client, - inner: - crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestInputBuilder, + pub(crate) inner: crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2InputBuilder, } impl GetEnumV2ThirdKnownValueTestFluentBuilder { /// Creates a new `GetEnumV2ThirdKnownValueTest`. @@ -33,52 +35,40 @@ impl GetEnumV2ThirdKnownValueTestFluentBuilder { } } /// Access the GetEnumV2ThirdKnownValueTest as a reference. - pub fn as_input( - &self, - ) -> &crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestInputBuilder - { + pub fn as_input(&self) -> &crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2InputBuilder { &self.inner } /// Sends the request and returns the response. pub async fn send( self, ) -> ::std::result::Result< - crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestOutput, + crate::operation::get_enum_v2_third_known_value_test::GetEnumV2Output, crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestError, > { let input = self .inner .build() - // Using unhandled since GetEnumV2 doesn't declare any validation, + // Using unhandled since GetEnumV2ThirdKnownValueTest doesn't declare any validation, // and smithy-rs seems to not generate a ValidationError case unless there is // (but isn't that a backwards compatibility problem for output structures?) // Vanilla smithy-rs uses SdkError::construction_failure, // but we aren't using SdkError. .map_err(crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestError::unhandled)?; - crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTest::send( - &self.client, - input, - ) - .await + crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTest::send(&self.client, input).await } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: crate::types::simple_enum_v2_shape::SimpleEnumV2Shape) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value( - mut self, - input: ::std::option::Option, - ) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value( - &self, - ) -> &::std::option::Option { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/standard_library_conversions.rs index 3a51134c6..6bf8297d8 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/standard_library_conversions.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/standard_library_conversions.rs @@ -1,246 +1,266 @@ pub fn ostring_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, > { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) - }, - None => crate::_Wrappers_Compile::Option::None {}, + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) + }, + None => crate::_Wrappers_Compile::Option::None {}, }; - ::std::rc::Rc::new(dafny_value) + ::std::rc::Rc::new(dafny_value) } pub fn ostring_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, - >, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input.Extract(), - ), - ) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some( + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input.Extract(), + ), + ) + } else { + None + } } -pub fn obool_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn obool_to_dafny( + input: &Option, +) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn obool_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn obool_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn olong_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn olong_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn olong_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn blob_to_dafny( - input: &::aws_smithy_types::Blob, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) +pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) } pub fn oblob_to_dafny( - input: &Option<::aws_smithy_types::Blob>, + input: &Option<::aws_smithy_types::Blob>, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: blob_to_dafny(&b), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { + value: blob_to_dafny(&b), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn blob_from_dafny( - input: ::dafny_runtime::Sequence, -) -> ::aws_smithy_types::Blob { - - ::aws_smithy_types::Blob::new( - ::std::rc::Rc::try_unwrap(input.to_array()) - .unwrap_or_else(|rc| (*rc).clone()), - ) +pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { + ::aws_smithy_types::Blob::new( + ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), + ) } pub fn oblob_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option<::aws_smithy_types::Blob> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(blob_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(blob_from_dafny(input.Extract())) + } else { + None + } } -pub fn double_to_dafny( - input: f64, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( - &f64::to_be_bytes(input).to_vec(), - |x| *x) +pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( + &f64::to_be_bytes(input).to_vec(), + |x| *x, + ) } pub fn odouble_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: double_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: double_to_dafny(*f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn double_from_dafny( - input: &::dafny_runtime::Sequence, -) -> f64 { - let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); - f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) +pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { + let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); + f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) } pub fn odouble_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(double_from_dafny(&input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(double_from_dafny(&input.Extract())) + } else { + None + } } pub fn timestamp_to_dafny( - input: ::aws_smithy_types::DateTime, + input: &::aws_smithy_types::DateTime, ) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&input.to_string()) + ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &input.to_string(), + ) } pub fn otimestamp_to_dafny( - input: &Option<::aws_smithy_types::DateTime>, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: timestamp_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + input: &Option<::aws_smithy_types::DateTime>, +) -> ::std::rc::Rc< + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, +> { + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: timestamp_to_dafny(f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn timestamp_from_dafny( - input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, ) -> ::aws_smithy_types::DateTime { - let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&input); - ::aws_smithy_types::DateTime::from_str( - &s, - aws_smithy_types::date_time::Format::DateTime, - ).unwrap() + let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input, + ); + ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) + .unwrap() } pub fn otimestamp_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option<::aws_smithy_types::DateTime> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(timestamp_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(timestamp_from_dafny(input.Extract())) + } else { + None + } } pub fn option_from_dafny( - input: ::std::rc::Rc>, - converter: fn(&T) -> TR, + input: ::std::rc::Rc>, + converter: fn(&T) -> TR, ) -> Option { - match &*input { - crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), - crate::_Wrappers_Compile::Option::None { } => None, - } + match &*input { + crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), + crate::_Wrappers_Compile::Option::None {} => None, + } } pub fn option_to_dafny( - input: &Option, - converter: fn(&TR) -> T, + input: &Option, + converter: fn(&TR) -> T, ) -> ::std::rc::Rc> { - match input { - Some(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::Some { - value: converter(&value) - } - ), - None => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::None {} - ), - } + match input { + Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { + value: converter(&value), + }), + None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), + } } pub fn result_from_dafny( - input: ::std::rc::Rc>, - converter_t: fn(&T) -> TR, - converter_e: fn(&E) -> ER, + input: ::std::rc::Rc>, + converter_t: fn(&T) -> TR, + converter_e: fn(&E) -> ER, ) -> Result { - match &*input { - crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), - crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), - } + match &*input { + crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), + crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), + } } pub fn result_to_dafny( - input: &Result, - converter_t: fn(&TR) -> T, - converter_e: fn(&ER) -> E, + input: &Result, + converter_t: fn(&TR) -> T, + converter_e: fn(&ER) -> E, ) -> ::std::rc::Rc> { - match input { - Ok(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: converter_t(&value) - } - ), - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: converter_e(&error) - } - ), - } -} \ No newline at end of file + match input { + Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { + value: converter_t(&value), + }), + Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { + error: converter_e(&error), + }), + } +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/standard_library_externs.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types.rs index 951f1e5c4..bd9720ed2 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types.rs @@ -1,5 +1,8 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -/// Types for the `SimpleIntegerConfig` +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +/// Types for the `SimpleEnumV2Config` pub mod simple_enum_v2_config; -pub mod simple_enum_v2_shape; + +mod _simple_enum_v2_shape; +pub use crate::types::_simple_enum_v2_shape::SimpleEnumV2Shape; diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/_simple_enum_v2_shape.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/_simple_enum_v2_shape.rs new file mode 100644 index 000000000..6747128c1 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/_simple_enum_v2_shape.rs @@ -0,0 +1,19 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[derive(Debug, PartialEq, Copy, Clone)] +pub enum SimpleEnumV2Shape { + First, +Second, +Third, +} + +impl ::std::fmt::Display for SimpleEnumV2Shape { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + SimpleEnumV2Shape::First => write!(f, "FIRST"), +SimpleEnumV2Shape::Second => write!(f, "SECOND"), +SimpleEnumV2Shape::Third => write!(f, "THIRD"), + } + } +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_config.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_config.rs index 37b2d81ac..d03031da8 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_config.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_config.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct SimpleEnumV2Config {} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_shape.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_shape.rs deleted file mode 100644 index b1eb34728..000000000 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_shape.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[derive(Debug, PartialEq, Copy, Clone)] -pub enum SimpleEnumV2Shape { - FIRST, - SECOND, - THIRD, -} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/wrapped.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/wrapped.rs new file mode 100644 index 000000000..4bcdd7d0f --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/wrapped.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod client; + +impl crate::r#simple::types::enumv2::internaldafny::wrapped::_default { + pub fn WrappedSimpleEnumV2(config: &::std::rc::Rc< + crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Config, + >) -> ::std::rc::Rc, + ::std::rc::Rc + >>{ + crate::wrapped::client::Client::from_conf(config) + } +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/wrapped/client.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/wrapped/client.rs new file mode 100644 index 000000000..5beee2ab3 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/wrapped/client.rs @@ -0,0 +1,179 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use tokio::runtime::Runtime; + +pub struct Client { + wrapped: crate::client::Client, + + /// A `current_thread` runtime for executing operations on the + /// asynchronous client in a blocking manner. + rt: Runtime +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn crate::r#simple::types::enumv2::internaldafny::types::ISimpleTypesEnumV2Client); +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); +} + +impl Client { + pub fn from_conf(config: &::std::rc::Rc< + crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Config, + >) -> +::std::rc::Rc, + ::std::rc::Rc +>> { + let rt_result = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build(); + let rt = match rt_result { + Ok(x) => x, + Err(error) => return crate::conversions::error::to_opaque_error_result(error), + }; + let result = crate::client::Client::from_conf( + crate::conversions::simple_enum_v2_config::_simple_enum_v2_config::from_dafny( + config.clone(), + ), + ); + match result { + Ok(client) => { + let wrap = crate::wrapped::client::Client { + wrapped: client, + rt + }; + std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(wrap)) + } + ) + }, + Err(error) => crate::conversions::error::to_opaque_error_result(error) + } + } +} + +impl crate::r#simple::types::enumv2::internaldafny::types::ISimpleTypesEnumV2Client for Client { + fn GetEnumV2( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_enum_v2::_get_enum_v2_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_enum_v2::GetEnumV2::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_enum_v2::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_enum_v2::_get_enum_v2_output::to_dafny(client), + }, + ), + } + } + + fn GetEnumV2FirstKnownValueTest( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_enum_v2_first_known_value_test::_get_enum_v2_first_known_value_test_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTest::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_enum_v2_first_known_value_test::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_enum_v2_first_known_value_test::_get_enum_v2_first_known_value_test_output::to_dafny(client), + }, + ), + } + } + + fn GetEnumV2SecondKnownValueTest( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_enum_v2_second_known_value_test::_get_enum_v2_second_known_value_test_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTest::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_enum_v2_second_known_value_test::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_enum_v2_second_known_value_test::_get_enum_v2_second_known_value_test_output::to_dafny(client), + }, + ), + } + } + + fn GetEnumV2ThirdKnownValueTest( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Input, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::enumv2::internaldafny::types::GetEnumV2Output, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_enum_v2_third_known_value_test::_get_enum_v2_third_known_value_test_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTest::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_enum_v2_third_known_value_test::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_enum_v2_third_known_value_test::_get_enum_v2_third_known_value_test_output::to_dafny(client), + }, + ), + } + } +} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/tests/simple_enum_v2_test.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/tests/simple_enum_v2_test.rs index ddf89e15e..4ce5192c0 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/tests/simple_enum_v2_test.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/tests/simple_enum_v2_test.rs @@ -1,48 +1,48 @@ -use simple_enum_v2::types::simple_enum_v2_shape::SimpleEnumV2Shape::*; +use simple_enum_v2::types::SimpleEnumV2Shape::*; use simple_enum_v2::*; #[tokio::test] async fn test_get_enum() { - let result = client().get_enum_v2().value(SECOND).send().await; + let result = client().get_enum_v2().value(Second).send().await; let output = result.unwrap(); let value = output.value().unwrap(); - assert_eq!(value, SECOND); + assert_eq!(value, Second); } #[tokio::test] async fn test_get_first_known_value() { let result = client() .get_enum_v2_first_known_value_test() - .value(FIRST) + .value(First) .send() .await; let output = result.unwrap(); let value = output.value().unwrap(); - assert_eq!(value, FIRST); + assert_eq!(value, First); } #[tokio::test] async fn test_get_second_known_value() { let result = client() .get_enum_v2_second_known_value_test() - .value(SECOND) + .value(Second) .send() .await; let output = result.unwrap(); let value = output.value().unwrap(); - assert_eq!(value, SECOND); + assert_eq!(value, Second); } #[tokio::test] async fn test_get_third_known_value() { let result = client() .get_enum_v2_third_known_value_test() - .value(THIRD) + .value(Third) .send() .await; let output = result.unwrap(); let value = output.value().unwrap(); - assert_eq!(value, THIRD); + assert_eq!(value, Third); } pub fn client() -> Client { diff --git a/TestModels/SimpleTypes/SimpleInteger/Makefile b/TestModels/SimpleTypes/SimpleInteger/Makefile index 8eb6373ed..d16e17892 100644 --- a/TestModels/SimpleTypes/SimpleInteger/Makefile +++ b/TestModels/SimpleTypes/SimpleInteger/Makefile @@ -3,8 +3,9 @@ CORES=2 +TRANSPILE_TESTS_IN_RUST=1 + ENABLE_EXTERN_PROCESSING=1 -RUST_BENERATED=1 include ../../SharedMakefile.mk diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/Cargo.toml b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/Cargo.toml index d14ad003b..3ef7587f6 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/Cargo.toml +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/Cargo.toml @@ -5,13 +5,19 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +wrapped-client = [] + [dependencies] aws-smithy-runtime = {version = "1.6.0", features = ["client"] } aws-smithy-runtime-api = {version = "1.7.0", features = ["client"] } aws-smithy-types = "1.2.0" dafny_runtime = { path = "../../../../dafny-dependencies/dafny_runtime_rust"} -[dev-dependencies.tokio] +[dev-dependencies] +simple_integer = { path = ".", features = ["wrapped-client"] } + +[dependencies.tokio] version = "1.26.0" features = ["full"] diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client.rs index a82eefe99..077a86986 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use aws_smithy_types::error::operation::BuildError; #[derive(::std::clone::Clone, ::std::fmt::Debug)] @@ -29,11 +30,11 @@ impl Client { )); } Ok(Self { - dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), + dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) }) } } mod get_integer; -mod get_integer_known_value; +mod get_integer_known_value_test; diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer.rs index ac241528f..11767e3f9 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer.rs @@ -1,11 +1,13 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { /// Constructs a fluent builder for the [`GetInteger`](crate::operation::get_integer::builders::GetIntegerFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(i32)`](crate::operation::get_integer::builders::GetIntegerFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_integer::builders::GetIntegerFluentBuilder::set_value):(undocumented)
+ /// - [`value(impl Into>)`](crate::operation::get_integer::builders::GetIntegerFluentBuilder::value) / [`set_value(Option<::std::primitive::i32>)`](crate::operation::get_integer::builders::GetIntegerFluentBuilder::set_value): (undocumented)
/// - On success, responds with [`GetIntegerOutput`](crate::operation::get_integer::GetIntegerOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_integer::GetIntegerOutput::value): (undocumented) + /// - [`value(Option<::std::primitive::i32>)`](crate::operation::get_integer::GetIntegerOutput::value): (undocumented) /// - On failure, responds with [`SdkError`](crate::operation::get_integer::GetIntegerError) pub fn get_integer(&self) -> crate::operation::get_integer::builders::GetIntegerFluentBuilder { crate::operation::get_integer::builders::GetIntegerFluentBuilder::new(self.clone()) diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer_known_value.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer_known_value.rs deleted file mode 100644 index 82695c20f..000000000 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer_known_value.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -impl super::Client { - /// Constructs a fluent builder for the [`GetInteger`](crate::operation::get_integer_known_value::builders::GetIntegerFluentBuilder) operation. - /// - /// - The fluent builder is configurable: - /// - [`value(i32)`](crate::operation::get_integer_known_value::builders::GetIntegerFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_integer_known_value::builders::GetIntegerFluentBuilder::set_value):(undocumented)
- /// - On success, responds with [`GetIntegerOutput`](crate::operation::get_integer_known_value::GetIntegerOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_integer_known_value::GetIntegerOutput::value): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::get_integer_known_value::GetIntegerError) - pub fn get_integer_known_value( - &self, - ) -> crate::operation::get_integer_known_value::builders::GetIntegerKnownValueFluentBuilder - { - crate::operation::get_integer_known_value::builders::GetIntegerKnownValueFluentBuilder::new( - self.clone(), - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer_known_value_test.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer_known_value_test.rs new file mode 100644 index 000000000..7612ae9e5 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer_known_value_test.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +impl super::Client { + /// Constructs a fluent builder for the [`GetIntegerKnownValueTest`](crate::operation::get_integer_known_value_test::builders::GetIntegerKnownValueTestFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`value(impl Into>)`](crate::operation::get_integer_known_value_test::builders::GetIntegerKnownValueTestFluentBuilder::value) / [`set_value(Option<::std::primitive::i32>)`](crate::operation::get_integer_known_value_test::builders::GetIntegerKnownValueTestFluentBuilder::set_value): (undocumented)
+ /// - On success, responds with [`GetIntegerOutput`](crate::operation::get_integer_known_value_test::GetIntegerOutput) with field(s): + /// - [`value(Option<::std::primitive::i32>)`](crate::operation::get_integer_known_value_test::GetIntegerOutput::value): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_integer_known_value_test::GetIntegerKnownValueTestError) + pub fn get_integer_known_value_test(&self) -> crate::operation::get_integer_known_value_test::builders::GetIntegerKnownValueTestFluentBuilder { + crate::operation::get_integer_known_value_test::builders::GetIntegerKnownValueTestFluentBuilder::new(self.clone()) + } +} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions.rs index 9d397cd05..0af6bf6b9 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions.rs @@ -1,6 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub mod get_integer; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod error; -pub mod get_integer_known_value; + pub mod get_integer; -pub mod simple_integer_config; + pub mod get_integer_known_value_test; + + pub mod simple_integer_config; diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/error.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/error.rs new file mode 100644 index 000000000..77c44d437 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/error.rs @@ -0,0 +1,32 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + /// Wraps up an arbitrary Rust Error value as a Dafny Error +pub fn to_opaque_error(value: E) -> + ::std::rc::Rc +{ + let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( + ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), + )); + ::std::rc::Rc::new( + crate::r#simple::types::integer::internaldafny::types::Error::Opaque { + obj: error_obj, + }, + ) +} + +/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure +pub fn to_opaque_error_result(value: E) -> + ::std::rc::Rc< + crate::_Wrappers_Compile::Result< + T, + ::std::rc::Rc + > + > +{ + ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: to_opaque_error(value), + }, + ) +} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer.rs index 3637ac26f..465334c3e 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_input.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_input.rs index 9b5403e08..03797dbbe 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_input.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_input.rs @@ -1,37 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_integer::GetIntegerInput, ) -> ::std::rc::Rc< crate::r#simple::types::integer::internaldafny::types::GetIntegerInput, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { value: v }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::integer::internaldafny::types::GetIntegerInput::GetIntegerInput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::oint_to_dafny(value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::integer::internaldafny::types::GetIntegerInput, >, ) -> crate::operation::get_integer::GetIntegerInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(dafny_value.value().Extract()) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_integer::GetIntegerInput { value } + crate::operation::get_integer::GetIntegerInput::builder() + .set_value(crate::standard_library_conversions::oint_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_output.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_output.rs index 088317722..9b8946b2b 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_output.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_output.rs @@ -1,37 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_integer::GetIntegerOutput, ) -> ::std::rc::Rc< crate::r#simple::types::integer::internaldafny::types::GetIntegerOutput, -> { - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::integer::internaldafny::types::GetIntegerOutput::GetIntegerOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::oint_to_dafny(value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::integer::internaldafny::types::GetIntegerOutput, >, ) -> crate::operation::get_integer::GetIntegerOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(dafny_value.value().Extract()) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_integer::GetIntegerOutput { value } + crate::operation::get_integer::GetIntegerOutput::builder() + .set_value(crate::standard_library_conversions::oint_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value.rs deleted file mode 100644 index 15c6b7c8b..000000000 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -use std::any::Any; - -#[allow(dead_code)] -pub fn to_dafny_error( - value: crate::operation::get_integer_known_value::GetIntegerKnownValueError, -) -> ::std::rc::Rc { - match value { - crate::operation::get_integer_known_value::GetIntegerKnownValueError::Unhandled(unhandled) => - ::std::rc::Rc::new(crate::r#simple::types::integer::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) - } -} - -#[allow(dead_code)] -pub fn from_dafny_error( - dafny_value: ::std::rc::Rc< - crate::r#simple::types::integer::internaldafny::types::Error, - >, -) -> crate::operation::get_integer_known_value::GetIntegerKnownValueError { - // TODO: Losing information here, but we have to figure out how to wrap an arbitrary Dafny value as std::error::Error - if matches!(&dafny_value.as_ref(), crate::r#simple::types::integer::internaldafny::types::Error::CollectionOfErrors { .. }) { - let error_message = "TODO: can't get message yet"; - crate::operation::get_integer_known_value::GetIntegerKnownValueError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) - } else { - crate::operation::get_integer_known_value::GetIntegerKnownValueError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) - } -} - -pub mod _get_integer_known_value_input; - -pub mod _get_integer_known_value_output; diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_input.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_input.rs deleted file mode 100644 index 40db6820d..000000000 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_input.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::get_integer_known_value::GetIntegerKnownValueInput, -) -> ::std::rc::Rc< - crate::r#simple::types::integer::internaldafny::types::GetIntegerInput, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { value: v }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(crate::r#simple::types::integer::internaldafny::types::GetIntegerInput::GetIntegerInput { - value: ::std::rc::Rc::new(dafny_value) - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::types::integer::internaldafny::types::GetIntegerInput, - >, -) -> crate::operation::get_integer_known_value::GetIntegerKnownValueInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(dafny_value.value().Extract()) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_integer_known_value::GetIntegerKnownValueInput { value } -} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_output.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_output.rs deleted file mode 100644 index c122e6bee..000000000 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_output.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::get_integer_known_value::GetIntegerKnownValueOutput, -) -> ::std::rc::Rc< - crate::r#simple::types::integer::internaldafny::types::GetIntegerOutput, -> { - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(crate::r#simple::types::integer::internaldafny::types::GetIntegerOutput::GetIntegerOutput { - value: ::std::rc::Rc::new(dafny_value) - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::types::integer::internaldafny::types::GetIntegerOutput, - >, -) -> crate::operation::get_integer_known_value::GetIntegerKnownValueOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(dafny_value.value().Extract()) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_integer_known_value::GetIntegerKnownValueOutput { value } -} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value_test.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value_test.rs new file mode 100644 index 000000000..553b0b372 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value_test.rs @@ -0,0 +1,33 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::any::Any; + +#[allow(dead_code)] +pub fn to_dafny_error( + value: crate::operation::get_integer_known_value_test::GetIntegerKnownValueTestError, +) -> ::std::rc::Rc { + match value { + crate::operation::get_integer_known_value_test::GetIntegerKnownValueTestError::Unhandled(unhandled) => + ::std::rc::Rc::new(crate::r#simple::types::integer::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) + } +} + +#[allow(dead_code)] +pub fn from_dafny_error( + dafny_value: ::std::rc::Rc< + crate::r#simple::types::integer::internaldafny::types::Error, + >, +) -> crate::operation::get_integer_known_value_test::GetIntegerKnownValueTestError { + // TODO: Losing information here, but we have to figure out how to wrap an arbitrary Dafny value as std::error::Error + if matches!(&dafny_value.as_ref(), crate::r#simple::types::integer::internaldafny::types::Error::CollectionOfErrors { .. }) { + let error_message = "TODO: can't get message yet"; + crate::operation::get_integer_known_value_test::GetIntegerKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) + } else { + crate::operation::get_integer_known_value_test::GetIntegerKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) + } +} + +pub mod _get_integer_known_value_test_input; + +pub mod _get_integer_known_value_test_output; diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value_test/_get_integer_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value_test/_get_integer_known_value_test_input.rs new file mode 100644 index 000000000..0b004b785 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value_test/_get_integer_known_value_test_input.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::get_integer_known_value_test::GetIntegerInput, +) -> ::std::rc::Rc< + crate::r#simple::types::integer::internaldafny::types::GetIntegerInput, +>{ + ::std::rc::Rc::new(crate::r#simple::types::integer::internaldafny::types::GetIntegerInput::GetIntegerInput { + value: crate::standard_library_conversions::oint_to_dafny(value.value), + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::types::integer::internaldafny::types::GetIntegerInput, + >, +) -> crate::operation::get_integer_known_value_test::GetIntegerInput { + crate::operation::get_integer_known_value_test::GetIntegerInput::builder() + .set_value(crate::standard_library_conversions::oint_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() +} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value_test/_get_integer_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value_test/_get_integer_known_value_test_output.rs new file mode 100644 index 000000000..19f8b437b --- /dev/null +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value_test/_get_integer_known_value_test_output.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::get_integer_known_value_test::GetIntegerOutput, +) -> ::std::rc::Rc< + crate::r#simple::types::integer::internaldafny::types::GetIntegerOutput, +>{ + ::std::rc::Rc::new(crate::r#simple::types::integer::internaldafny::types::GetIntegerOutput::GetIntegerOutput { + value: crate::standard_library_conversions::oint_to_dafny(value.value), + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::types::integer::internaldafny::types::GetIntegerOutput, + >, +) -> crate::operation::get_integer_known_value_test::GetIntegerOutput { + crate::operation::get_integer_known_value_test::GetIntegerOutput::builder() + .set_value(crate::standard_library_conversions::oint_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() +} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config.rs index f3cdb7384..f25f66bfe 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config.rs @@ -1,3 +1,4 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub mod _simple_integer_config; diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config/_simple_integer_config.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config/_simple_integer_config.rs index 360d19898..a712be2fb 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config/_simple_integer_config.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config/_simple_integer_config.rs @@ -1,10 +1,12 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::types::simple_integer_config::SimpleIntegerConfig, ) -> ::std::rc::Rc< - crate::simple::types::integer::internaldafny::types::SimpleIntegerConfig, + crate::r#simple::types::integer::internaldafny::types::SimpleIntegerConfig, > { ::std::rc::Rc::new(crate::r#simple::types::integer::internaldafny::types::SimpleIntegerConfig::SimpleIntegerConfig {}) } diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error.rs index ec89cbecc..4cddaa7c3 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use ::aws_smithy_runtime_api::box_error::BoxError; /// Error type returned by the client. diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error/sealed_unhandled.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error/sealed_unhandled.rs index cce22d1cf..eae800729 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error/sealed_unhandled.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error/sealed_unhandled.rs @@ -1,4 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::any::Any; + +use dafny_runtime::UpcastObject; + /// This struct is not intended to be used. /// /// This struct holds information about an unhandled error, @@ -21,6 +27,6 @@ pub struct Unhandled { pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, } -impl ::dafny_runtime::UpcastObject for Unhandled { +impl UpcastObject for Unhandled { ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); } diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/lib.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/lib.rs deleted file mode 100644 index e427bffab..000000000 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/lib.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![allow(deprecated)] - -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -pub mod client; -pub mod types; - -/// Common errors and error handling utilities. -pub mod error; - -/// All operations that this crate can perform. -pub mod operation; - -mod conversions; - -pub mod implementation_from_dafny; - -pub use client::Client; -pub use types::simple_integer_config::SimpleIntegerConfig; diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation.rs index faaa994cb..94588bbdb 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation.rs @@ -1,7 +1,8 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `GetInteger` operation. pub mod get_integer; -/// Types for the `GetIntegerKnownValue` operation. -pub mod get_integer_known_value; +/// Types for the `GetIntegerKnownValueTest` operation. +pub mod get_integer_known_value_test; diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer.rs index 3cb49535a..1887a2158 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetInteger`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -137,9 +139,9 @@ pub use crate::operation::get_integer::_get_integer_output::GetIntegerOutput; pub use crate::operation::get_integer::_get_integer_input::GetIntegerInput; -mod _get_integer_input; +pub(crate) mod _get_integer_output; -mod _get_integer_output; +pub(crate) mod _get_integer_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_input.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_input.rs index ab0c63e08..ae911475a 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_input.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_input.rs @@ -1,16 +1,18 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetIntegerInput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, +pub value: ::std::option::Option<::std::primitive::i32>, } impl GetIntegerInput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&i32> { - self.value.as_ref() - } +pub fn value(&self) -> ::std::option::Option<::std::primitive::i32> { + self.value +} } impl GetIntegerInput { /// Creates a new builder-style object to manufacture [`GetIntegerInput`](crate::operation::operation::GetIntegerInput). @@ -25,23 +27,23 @@ impl GetIntegerInput { ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, )] pub struct GetIntegerInputBuilder { - pub(crate) value: ::std::option::Option, + pub(crate) value: ::std::option::Option<::std::primitive::i32>, } impl GetIntegerInputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - &self.value - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::i32>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::i32>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::i32> { + &self.value +} /// Consumes the builder and constructs a [`GetIntegerInput`](crate::operation::operation::GetIntegerInput). pub fn build( self, diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_output.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_output.rs index 49ae58c83..354b4fb6a 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_output.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_output.rs @@ -1,19 +1,19 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetIntegerOutput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, +pub value: ::std::option::Option<::std::primitive::i32>, } - impl GetIntegerOutput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } +pub fn value(&self) -> ::std::option::Option<::std::primitive::i32> { + self.value +} } - impl GetIntegerOutput { /// Creates a new builder-style object to manufacture [`GetIntegerOutput`](crate::operation::operation::GetIntegerOutput). pub fn builder() -> crate::operation::get_integer::builders::GetIntegerOutputBuilder { @@ -27,27 +27,23 @@ impl GetIntegerOutput { ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, )] pub struct GetIntegerOutputBuilder { - pub(crate) value: ::std::option::Option, + pub(crate) value: ::std::option::Option<::std::primitive::i32>, } - impl GetIntegerOutputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.value = input; - self - } - - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - &self.value - } - +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::i32>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::i32>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::i32> { + &self.value +} /// Consumes the builder and constructs a [`GetIntegerOutput`](crate::operation::operation::GetIntegerOutput). pub fn build( self, diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/builders.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/builders.rs index 74d985a93..f96df4a71 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/builders.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/builders.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use crate::operation::get_integer::_get_integer_output::GetIntegerOutputBuilder; pub use crate::operation::get_integer::_get_integer_input::GetIntegerInputBuilder; @@ -21,8 +23,8 @@ impl GetIntegerInputBuilder { /// #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetIntegerFluentBuilder { - client: crate::Client, - inner: crate::operation::get_integer::builders::GetIntegerInputBuilder, + client: crate::client::Client, + pub(crate) inner: crate::operation::get_integer::builders::GetIntegerInputBuilder, } impl GetIntegerFluentBuilder { /// Creates a new `GetInteger`. @@ -56,17 +58,17 @@ impl GetIntegerFluentBuilder { } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: i32) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::i32>) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::i32>) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::i32> { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_input.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_input.rs deleted file mode 100644 index 83a4b8291..000000000 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_input.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetIntegerKnownValueInput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetIntegerKnownValueInput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } -} -impl GetIntegerKnownValueInput { - /// Creates a new builder-style object to manufacture [`GetIntegerKnownValueInput`](crate::operation::operation::GetIntegerKnownValueInput). - pub fn builder( - ) -> crate::operation::get_integer_known_value::builders::GetIntegerKnownValueInputBuilder { - crate::operation::get_integer_known_value::builders::GetIntegerKnownValueInputBuilder::default() - } -} - -/// A builder for [`GetIntegerKnownValueInput`](crate::operation::operation::GetIntegerKnownValueInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetIntegerKnownValueInputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetIntegerKnownValueInputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetIntegerKnownValueInput`](crate::operation::operation::GetIntegerKnownValueInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_integer_known_value::GetIntegerKnownValueInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_integer_known_value::GetIntegerKnownValueInput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_output.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_output.rs deleted file mode 100644 index f80e3163b..000000000 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_output.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetIntegerKnownValueOutput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetIntegerKnownValueOutput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } -} -impl GetIntegerKnownValueOutput { - /// Creates a new builder-style object to manufacture [`GetIntegerKnownValueOutput`](crate::operation::operation::GetIntegerKnownValueOutput). - pub fn builder( - ) -> crate::operation::get_integer_known_value::builders::GetIntegerKnownValueOutputBuilder - { - crate::operation::get_integer_known_value::builders::GetIntegerKnownValueOutputBuilder::default() - } -} - -/// A builder for [`GetIntegerKnownValueOutput`](crate::operation::operation::GetIntegerKnownValueOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetIntegerKnownValueOutputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetIntegerKnownValueOutputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetIntegerKnownValueOutput`](crate::operation::operation::GetIntegerKnownValueOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_integer_known_value::GetIntegerKnownValueOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_integer_known_value::GetIntegerKnownValueOutput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/builders.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/builders.rs deleted file mode 100644 index 9cfc99ee3..000000000 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/builders.rs +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_integer_known_value::_get_integer_known_value_output::GetIntegerKnownValueOutputBuilder; - -pub use crate::operation::get_integer_known_value::_get_integer_known_value_input::GetIntegerKnownValueInputBuilder; - -impl GetIntegerKnownValueInputBuilder { - /// Sends a request with this input using the given client. - pub async fn send_with( - self, - client: &crate::Client, - ) -> ::std::result::Result< - crate::operation::get_integer_known_value::GetIntegerKnownValueOutput, - crate::operation::get_integer_known_value::GetIntegerKnownValueError, - > { - let mut fluent_builder = client.get_integer_known_value(); - fluent_builder.inner = self; - fluent_builder.send().await - } -} -/// Fluent builder constructing a request to `GetIntegerKnownValue`. -/// -#[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct GetIntegerKnownValueFluentBuilder { - client: crate::client::Client, - inner: crate::operation::get_integer_known_value::builders::GetIntegerKnownValueInputBuilder, -} -impl GetIntegerKnownValueFluentBuilder { - /// Creates a new `GetIntegerKnownValue`. - pub(crate) fn new(client: crate::client::Client) -> Self { - Self { - client, - inner: ::std::default::Default::default(), - } - } - /// Access the GetIntegerKnownValue as a reference. - pub fn as_input( - &self, - ) -> &crate::operation::get_integer_known_value::builders::GetIntegerKnownValueInputBuilder - { - &self.inner - } - /// Sends the request and returns the response. - pub async fn send( - self, - ) -> ::std::result::Result< - crate::operation::get_integer_known_value::GetIntegerKnownValueOutput, - crate::operation::get_integer_known_value::GetIntegerKnownValueError, - > { - let input = self - .inner - .build() - // Using unhandled since GetInteger doesn't declare any validation, - // and smithy-rs seems to not generate a ValidationError case unless there is - // (but isn't that a backwards compatibility problem for output structures?) - // Vanilla smithy-rs uses SdkError::construction_failure, - // but we aren't using SdkError. - .map_err( - crate::operation::get_integer_known_value::GetIntegerKnownValueError::unhandled, - )?; - crate::operation::get_integer_known_value::GetIntegerKnownValue::send(&self.client, input) - .await - } - - #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: i32) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - self.inner.get_value() - } -} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test.rs similarity index 67% rename from TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value.rs rename to TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test.rs index 06e0fa0cb..0a0f7a508 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test.rs @@ -1,49 +1,46 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -/// Orchestration and serialization glue logic for `GetIntegerKnownValue`. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +/// Orchestration and serialization glue logic for `GetIntegerKnownValueTest`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] -pub struct GetIntegerKnownValue; -impl GetIntegerKnownValue { - /// Creates a new `GetIntegerKnownValue` +pub struct GetIntegerKnownValueTest; +impl GetIntegerKnownValueTest { + /// Creates a new `GetIntegerKnownValueTest` pub fn new() -> Self { Self } pub(crate) async fn send( client: &crate::client::Client, - input: crate::operation::get_integer_known_value::GetIntegerKnownValueInput, + input: crate::operation::get_integer_known_value_test::GetIntegerInput, ) -> ::std::result::Result< - crate::operation::get_integer_known_value::GetIntegerKnownValueOutput, - crate::operation::get_integer_known_value::GetIntegerKnownValueError, + crate::operation::get_integer_known_value_test::GetIntegerOutput, + crate::operation::get_integer_known_value_test::GetIntegerKnownValueTestError, > { - let inner_input = - crate::conversions::get_integer_known_value::_get_integer_known_value_input::to_dafny( - input, - ); + let inner_input = crate::conversions::get_integer_known_value_test::_get_integer_known_value_test_input::to_dafny(input); let inner_result = - ::dafny_runtime::md!(client.dafny_client.clone()).GetInteger(&inner_input); + ::dafny_runtime::md!(client.dafny_client.clone()).GetIntegerKnownValueTest(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } ) { Ok( - crate::conversions::get_integer_known_value::_get_integer_known_value_output::from_dafny( + crate::conversions::get_integer_known_value_test::_get_integer_known_value_test_output::from_dafny( inner_result.value().clone(), ), ) } else { - Err( - crate::conversions::get_integer_known_value::from_dafny_error( - inner_result.error().clone(), - ), - ) + Err(crate::conversions::get_integer_known_value_test::from_dafny_error( + inner_result.error().clone(), + )) } } } -/// Error type for the `GetIntegerKnownValue` operation. +/// Error type for the `GetIntegerKnownValueTest` operation. #[non_exhaustive] #[derive(::std::fmt::Debug)] -pub enum GetIntegerKnownValueError { +pub enum GetIntegerKnownValueTestError { /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). #[deprecated( note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ @@ -51,12 +48,12 @@ pub enum GetIntegerKnownValueError { \    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` \ - See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetIntegerKnownValueError) for what information is available for the error." + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetIntegerKnownValueTestError) for what information is available for the error." )] Unhandled(crate::error::sealed_unhandled::Unhandled), } -impl GetIntegerKnownValueError { - /// Creates the `GetIntegerKnownValueError::Unhandled` variant from any error type. +impl GetIntegerKnownValueTestError { + /// Creates the `GetIntegerKnownValueTestError::Unhandled` variant from any error type. pub fn unhandled( err: impl ::std::convert::Into< ::std::boxed::Box< @@ -70,7 +67,7 @@ impl GetIntegerKnownValueError { }) } - /// Creates the `GetIntegerKnownValueError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + /// Creates the `GetIntegerKnownValueTestError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), @@ -87,14 +84,14 @@ impl GetIntegerKnownValueError { } } } -impl ::std::error::Error for GetIntegerKnownValueError { +impl ::std::error::Error for GetIntegerKnownValueTestError { fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { match self { Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source), } } } -impl ::std::fmt::Display for GetIntegerKnownValueError { +impl ::std::fmt::Display for GetIntegerKnownValueTestError { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match self { Self::Unhandled(_inner) => { @@ -109,7 +106,7 @@ impl ::std::fmt::Display for GetIntegerKnownValueError { } } } -impl ::aws_smithy_types::retry::ProvideErrorKind for GetIntegerKnownValueError { +impl ::aws_smithy_types::retry::ProvideErrorKind for GetIntegerKnownValueTestError { fn code(&self) -> ::std::option::Option<&str> { ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) } @@ -117,14 +114,14 @@ impl ::aws_smithy_types::retry::ProvideErrorKind for GetIntegerKnownValueError { ::std::option::Option::None } } -impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetIntegerKnownValueError { +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetIntegerKnownValueTestError { fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { match self { Self::Unhandled(_inner) => &_inner.meta, } } } -impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetIntegerKnownValueError { +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetIntegerKnownValueTestError { fn create_unhandled_error( source: ::std::boxed::Box< dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, @@ -138,13 +135,13 @@ impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetInteg } } -pub use crate::operation::get_integer_known_value::_get_integer_known_value_output::GetIntegerKnownValueOutput; +pub use crate::operation::get_integer_known_value_test::_get_integer_output::GetIntegerOutput; -pub use crate::operation::get_integer_known_value::_get_integer_known_value_input::GetIntegerKnownValueInput; +pub use crate::operation::get_integer_known_value_test::_get_integer_input::GetIntegerInput; -mod _get_integer_known_value_input; +pub(crate) mod _get_integer_output; -mod _get_integer_known_value_output; +pub(crate) mod _get_integer_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test/_get_integer_input.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test/_get_integer_input.rs new file mode 100644 index 000000000..43e834f3d --- /dev/null +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test/_get_integer_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetIntegerInput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option<::std::primitive::i32>, +} +impl GetIntegerInput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option<::std::primitive::i32> { + self.value +} +} +impl GetIntegerInput { + /// Creates a new builder-style object to manufacture [`GetIntegerInput`](crate::operation::operation::GetIntegerInput). + pub fn builder() -> crate::operation::get_integer_known_value_test::builders::GetIntegerInputBuilder { + crate::operation::get_integer_known_value_test::builders::GetIntegerInputBuilder::default() + } +} + +/// A builder for [`GetIntegerInput`](crate::operation::operation::GetIntegerInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetIntegerInputBuilder { + pub(crate) value: ::std::option::Option<::std::primitive::i32>, +} +impl GetIntegerInputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::i32>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::i32>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::i32> { + &self.value +} + /// Consumes the builder and constructs a [`GetIntegerInput`](crate::operation::operation::GetIntegerInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_integer_known_value_test::GetIntegerInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_integer_known_value_test::GetIntegerInput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test/_get_integer_output.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test/_get_integer_output.rs new file mode 100644 index 000000000..c1c00f46e --- /dev/null +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test/_get_integer_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetIntegerOutput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option<::std::primitive::i32>, +} +impl GetIntegerOutput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option<::std::primitive::i32> { + self.value +} +} +impl GetIntegerOutput { + /// Creates a new builder-style object to manufacture [`GetIntegerOutput`](crate::operation::operation::GetIntegerOutput). + pub fn builder() -> crate::operation::get_integer_known_value_test::builders::GetIntegerOutputBuilder { + crate::operation::get_integer_known_value_test::builders::GetIntegerOutputBuilder::default() + } +} + +/// A builder for [`GetIntegerOutput`](crate::operation::operation::GetIntegerOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetIntegerOutputBuilder { + pub(crate) value: ::std::option::Option<::std::primitive::i32>, +} +impl GetIntegerOutputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::i32>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::i32>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::i32> { + &self.value +} + /// Consumes the builder and constructs a [`GetIntegerOutput`](crate::operation::operation::GetIntegerOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_integer_known_value_test::GetIntegerOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_integer_known_value_test::GetIntegerOutput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test/builders.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test/builders.rs new file mode 100644 index 000000000..a7554ca93 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value_test/builders.rs @@ -0,0 +1,74 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::get_integer_known_value_test::_get_integer_output::GetIntegerOutputBuilder; + +pub use crate::operation::get_integer_known_value_test::_get_integer_input::GetIntegerInputBuilder; + +impl GetIntegerInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with( + self, + client: &crate::Client, + ) -> ::std::result::Result< + crate::operation::get_integer_known_value_test::GetIntegerOutput, + crate::operation::get_integer_known_value_test::GetIntegerKnownValueTestError, + > { + let mut fluent_builder = client.get_integer_known_value_test(); + fluent_builder.inner = self; + fluent_builder.send().await + } +} +/// Fluent builder constructing a request to `GetIntegerKnownValueTest`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct GetIntegerKnownValueTestFluentBuilder { + client: crate::client::Client, + pub(crate) inner: crate::operation::get_integer_known_value_test::builders::GetIntegerInputBuilder, +} +impl GetIntegerKnownValueTestFluentBuilder { + /// Creates a new `GetIntegerKnownValueTest`. + pub(crate) fn new(client: crate::client::Client) -> Self { + Self { + client, + inner: ::std::default::Default::default(), + } + } + /// Access the GetIntegerKnownValueTest as a reference. + pub fn as_input(&self) -> &crate::operation::get_integer_known_value_test::builders::GetIntegerInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + pub async fn send( + self, + ) -> ::std::result::Result< + crate::operation::get_integer_known_value_test::GetIntegerOutput, + crate::operation::get_integer_known_value_test::GetIntegerKnownValueTestError, + > { + let input = self + .inner + .build() + // Using unhandled since GetIntegerKnownValueTest doesn't declare any validation, + // and smithy-rs seems to not generate a ValidationError case unless there is + // (but isn't that a backwards compatibility problem for output structures?) + // Vanilla smithy-rs uses SdkError::construction_failure, + // but we aren't using SdkError. + .map_err(crate::operation::get_integer_known_value_test::GetIntegerKnownValueTestError::unhandled)?; + crate::operation::get_integer_known_value_test::GetIntegerKnownValueTest::send(&self.client, input).await + } + + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::i32>) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::i32>) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::i32> { + self.inner.get_value() +} +} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/standard_library_conversions.rs index 3a51134c6..6bf8297d8 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/standard_library_conversions.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/standard_library_conversions.rs @@ -1,246 +1,266 @@ pub fn ostring_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, > { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) - }, - None => crate::_Wrappers_Compile::Option::None {}, + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) + }, + None => crate::_Wrappers_Compile::Option::None {}, }; - ::std::rc::Rc::new(dafny_value) + ::std::rc::Rc::new(dafny_value) } pub fn ostring_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, - >, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input.Extract(), - ), - ) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some( + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input.Extract(), + ), + ) + } else { + None + } } -pub fn obool_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn obool_to_dafny( + input: &Option, +) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn obool_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn obool_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn olong_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn olong_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn olong_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn blob_to_dafny( - input: &::aws_smithy_types::Blob, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) +pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) } pub fn oblob_to_dafny( - input: &Option<::aws_smithy_types::Blob>, + input: &Option<::aws_smithy_types::Blob>, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: blob_to_dafny(&b), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { + value: blob_to_dafny(&b), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn blob_from_dafny( - input: ::dafny_runtime::Sequence, -) -> ::aws_smithy_types::Blob { - - ::aws_smithy_types::Blob::new( - ::std::rc::Rc::try_unwrap(input.to_array()) - .unwrap_or_else(|rc| (*rc).clone()), - ) +pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { + ::aws_smithy_types::Blob::new( + ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), + ) } pub fn oblob_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option<::aws_smithy_types::Blob> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(blob_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(blob_from_dafny(input.Extract())) + } else { + None + } } -pub fn double_to_dafny( - input: f64, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( - &f64::to_be_bytes(input).to_vec(), - |x| *x) +pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( + &f64::to_be_bytes(input).to_vec(), + |x| *x, + ) } pub fn odouble_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: double_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: double_to_dafny(*f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn double_from_dafny( - input: &::dafny_runtime::Sequence, -) -> f64 { - let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); - f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) +pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { + let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); + f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) } pub fn odouble_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(double_from_dafny(&input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(double_from_dafny(&input.Extract())) + } else { + None + } } pub fn timestamp_to_dafny( - input: ::aws_smithy_types::DateTime, + input: &::aws_smithy_types::DateTime, ) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&input.to_string()) + ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &input.to_string(), + ) } pub fn otimestamp_to_dafny( - input: &Option<::aws_smithy_types::DateTime>, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: timestamp_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + input: &Option<::aws_smithy_types::DateTime>, +) -> ::std::rc::Rc< + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, +> { + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: timestamp_to_dafny(f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn timestamp_from_dafny( - input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, ) -> ::aws_smithy_types::DateTime { - let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&input); - ::aws_smithy_types::DateTime::from_str( - &s, - aws_smithy_types::date_time::Format::DateTime, - ).unwrap() + let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input, + ); + ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) + .unwrap() } pub fn otimestamp_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option<::aws_smithy_types::DateTime> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(timestamp_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(timestamp_from_dafny(input.Extract())) + } else { + None + } } pub fn option_from_dafny( - input: ::std::rc::Rc>, - converter: fn(&T) -> TR, + input: ::std::rc::Rc>, + converter: fn(&T) -> TR, ) -> Option { - match &*input { - crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), - crate::_Wrappers_Compile::Option::None { } => None, - } + match &*input { + crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), + crate::_Wrappers_Compile::Option::None {} => None, + } } pub fn option_to_dafny( - input: &Option, - converter: fn(&TR) -> T, + input: &Option, + converter: fn(&TR) -> T, ) -> ::std::rc::Rc> { - match input { - Some(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::Some { - value: converter(&value) - } - ), - None => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::None {} - ), - } + match input { + Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { + value: converter(&value), + }), + None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), + } } pub fn result_from_dafny( - input: ::std::rc::Rc>, - converter_t: fn(&T) -> TR, - converter_e: fn(&E) -> ER, + input: ::std::rc::Rc>, + converter_t: fn(&T) -> TR, + converter_e: fn(&E) -> ER, ) -> Result { - match &*input { - crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), - crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), - } + match &*input { + crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), + crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), + } } pub fn result_to_dafny( - input: &Result, - converter_t: fn(&TR) -> T, - converter_e: fn(&ER) -> E, + input: &Result, + converter_t: fn(&TR) -> T, + converter_e: fn(&ER) -> E, ) -> ::std::rc::Rc> { - match input { - Ok(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: converter_t(&value) - } - ), - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: converter_e(&error) - } - ), - } -} \ No newline at end of file + match input { + Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { + value: converter_t(&value), + }), + Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { + error: converter_e(&error), + }), + } +} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/standard_library_externs.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types.rs index 0ab755433..646cdced2 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types.rs @@ -1,4 +1,5 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `SimpleIntegerConfig` pub mod simple_integer_config; diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types/simple_integer_config.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types/simple_integer_config.rs index 15a5df473..4851f5748 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types/simple_integer_config.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types/simple_integer_config.rs @@ -1,9 +1,8 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct SimpleIntegerConfig { - // XXX : ::std::option::Option -} +pub struct SimpleIntegerConfig {} impl SimpleIntegerConfig { pub fn builder() -> SimpleIntegerConfigBuilder { @@ -12,17 +11,12 @@ impl SimpleIntegerConfig { } #[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct SimpleIntegerConfigBuilder { - // XXX : ::std::option::Option -} +pub struct SimpleIntegerConfigBuilder {} impl SimpleIntegerConfigBuilder { /// Creates a new `SimpleIntegerConfigBuilder`. pub(crate) fn new() -> Self { - Self { - // XXX = ::std::option::Option::None - // somewhere get default values for things? - } + Self {} } pub fn build( self, @@ -30,19 +24,4 @@ impl SimpleIntegerConfigBuilder { { ::std::result::Result::Ok(SimpleIntegerConfig {}) } - /* - pub fn XXX(mut self, input: impl ::std::convert::Into) -> Self { - self.XXX = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_XXX(mut self, input: ::std::option::Option) -> Self { - self.XXX = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_XXX(&self) -> &::std::option::Option { - &self.XXX - } - */ } diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/wrapped.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/wrapped.rs new file mode 100644 index 000000000..77a3cb4cd --- /dev/null +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/wrapped.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod client; + +impl crate::r#simple::types::integer::internaldafny::wrapped::_default { + pub fn WrappedSimpleInteger(config: &::std::rc::Rc< + crate::r#simple::types::integer::internaldafny::types::SimpleIntegerConfig, + >) -> ::std::rc::Rc, + ::std::rc::Rc + >>{ + crate::wrapped::client::Client::from_conf(config) + } +} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/wrapped/client.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/wrapped/client.rs new file mode 100644 index 000000000..2df771a40 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/wrapped/client.rs @@ -0,0 +1,119 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use tokio::runtime::Runtime; + +pub struct Client { + wrapped: crate::client::Client, + + /// A `current_thread` runtime for executing operations on the + /// asynchronous client in a blocking manner. + rt: Runtime +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn crate::r#simple::types::integer::internaldafny::types::ISimpleTypesIntegerClient); +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); +} + +impl Client { + pub fn from_conf(config: &::std::rc::Rc< + crate::r#simple::types::integer::internaldafny::types::SimpleIntegerConfig, + >) -> +::std::rc::Rc, + ::std::rc::Rc +>> { + let rt_result = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build(); + let rt = match rt_result { + Ok(x) => x, + Err(error) => return crate::conversions::error::to_opaque_error_result(error), + }; + let result = crate::client::Client::from_conf( + crate::conversions::simple_integer_config::_simple_integer_config::from_dafny( + config.clone(), + ), + ); + match result { + Ok(client) => { + let wrap = crate::wrapped::client::Client { + wrapped: client, + rt + }; + std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(wrap)) + } + ) + }, + Err(error) => crate::conversions::error::to_opaque_error_result(error) + } + } +} + +impl crate::r#simple::types::integer::internaldafny::types::ISimpleTypesIntegerClient for Client { + fn GetInteger( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::integer::internaldafny::types::GetIntegerInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::integer::internaldafny::types::GetIntegerOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_integer::_get_integer_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_integer::GetInteger::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_integer::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_integer::_get_integer_output::to_dafny(client), + }, + ), + } + } + + fn GetIntegerKnownValueTest( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::integer::internaldafny::types::GetIntegerInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::integer::internaldafny::types::GetIntegerOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_integer_known_value_test::_get_integer_known_value_test_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_integer_known_value_test::GetIntegerKnownValueTest::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_integer_known_value_test::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_integer_known_value_test::_get_integer_known_value_test_output::to_dafny(client), + }, + ), + } + } +} diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/tests/simple_integer_test.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/tests/simple_integer_test.rs index 432eb5450..a48b2d5df 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/tests/simple_integer_test.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/tests/simple_integer_test.rs @@ -10,7 +10,7 @@ async fn test_get_integer() { #[tokio::test] async fn test_get_known_value() { - let result = client().get_integer_known_value().value(20).send().await; + let result = client().get_integer_known_value_test().value(20).send().await; let output = result.unwrap(); let value = output.value().unwrap(); assert_eq!(value, 20); diff --git a/TestModels/SimpleTypes/SimpleLong/Makefile b/TestModels/SimpleTypes/SimpleLong/Makefile index 0dd260a2b..c09454c43 100644 --- a/TestModels/SimpleTypes/SimpleLong/Makefile +++ b/TestModels/SimpleTypes/SimpleLong/Makefile @@ -3,8 +3,9 @@ CORES=2 +TRANSPILE_TESTS_IN_RUST=1 + ENABLE_EXTERN_PROCESSING=1 -RUST_BENERATED=1 include ../../SharedMakefile.mk diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/Cargo.toml b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/Cargo.toml index 6fa3747d2..9c0ced7f0 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/Cargo.toml +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/Cargo.toml @@ -5,13 +5,19 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +wrapped-client = [] + [dependencies] aws-smithy-runtime = {version = "1.6.0", features = ["client"] } aws-smithy-runtime-api = {version = "1.7.0", features = ["client"] } aws-smithy-types = "1.2.0" dafny_runtime = { path = "../../../../dafny-dependencies/dafny_runtime_rust"} -[dev-dependencies.tokio] +[dev-dependencies] +simple_long = { path = ".", features = ["wrapped-client"] } + +[dependencies.tokio] version = "1.26.0" features = ["full"] diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client.rs index 0529ead1f..6ec9bcc3e 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use aws_smithy_types::error::operation::BuildError; #[derive(::std::clone::Clone, ::std::fmt::Debug)] @@ -29,11 +30,11 @@ impl Client { )); } Ok(Self { - dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), + dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) }) } } mod get_long; -mod get_long_known_value; +mod get_long_known_value_test; diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long.rs index acd51ffb2..d420786f9 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long.rs @@ -1,11 +1,13 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { /// Constructs a fluent builder for the [`GetLong`](crate::operation::get_long::builders::GetLongFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(i64)`](crate::operation::get_long::builders::GetLongFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_long::builders::GetLongFluentBuilder::set_value):(undocumented)
+ /// - [`value(impl Into>)`](crate::operation::get_long::builders::GetLongFluentBuilder::value) / [`set_value(Option<::std::primitive::i64>)`](crate::operation::get_long::builders::GetLongFluentBuilder::set_value): (undocumented)
/// - On success, responds with [`GetLongOutput`](crate::operation::get_long::GetLongOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_long::GetLongOutput::value): (undocumented) + /// - [`value(Option<::std::primitive::i64>)`](crate::operation::get_long::GetLongOutput::value): (undocumented) /// - On failure, responds with [`SdkError`](crate::operation::get_long::GetLongError) pub fn get_long(&self) -> crate::operation::get_long::builders::GetLongFluentBuilder { crate::operation::get_long::builders::GetLongFluentBuilder::new(self.clone()) diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long_known_value.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long_known_value.rs deleted file mode 100644 index 197e3f5be..000000000 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long_known_value.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -impl super::Client { - /// Constructs a fluent builder for the [`GetLong`](crate::operation::get_long_known_value::builders::GetLongFluentBuilder) operation. - /// - /// - The fluent builder is configurable: - /// - [`value(i64)`](crate::operation::get_long_known_value::builders::GetLongFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_long_known_value::builders::GetLongFluentBuilder::set_value):(undocumented)
- /// - On success, responds with [`GetLongOutput`](crate::operation::get_long_known_value::GetLongOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_long_known_value::GetLongOutput::value): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::get_long_known_value::GetLongError) - pub fn get_long_known_value( - &self, - ) -> crate::operation::get_long_known_value::builders::GetLongKnownValueFluentBuilder { - crate::operation::get_long_known_value::builders::GetLongKnownValueFluentBuilder::new( - self.clone(), - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long_known_value_test.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long_known_value_test.rs new file mode 100644 index 000000000..d0cc474cc --- /dev/null +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long_known_value_test.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +impl super::Client { + /// Constructs a fluent builder for the [`GetLongKnownValueTest`](crate::operation::get_long_known_value_test::builders::GetLongKnownValueTestFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`value(impl Into>)`](crate::operation::get_long_known_value_test::builders::GetLongKnownValueTestFluentBuilder::value) / [`set_value(Option<::std::primitive::i64>)`](crate::operation::get_long_known_value_test::builders::GetLongKnownValueTestFluentBuilder::set_value): (undocumented)
+ /// - On success, responds with [`GetLongOutput`](crate::operation::get_long_known_value_test::GetLongOutput) with field(s): + /// - [`value(Option<::std::primitive::i64>)`](crate::operation::get_long_known_value_test::GetLongOutput::value): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_long_known_value_test::GetLongKnownValueTestError) + pub fn get_long_known_value_test(&self) -> crate::operation::get_long_known_value_test::builders::GetLongKnownValueTestFluentBuilder { + crate::operation::get_long_known_value_test::builders::GetLongKnownValueTestFluentBuilder::new(self.clone()) + } +} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions.rs index 4ff5bcbc9..a0cb33c55 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions.rs @@ -1,6 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub mod get_long; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod error; -pub mod get_long_known_value; + pub mod get_long; -pub mod simple_long_config; + pub mod get_long_known_value_test; + + pub mod simple_long_config; diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/error.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/error.rs new file mode 100644 index 000000000..4d0aeedd1 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/error.rs @@ -0,0 +1,32 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + /// Wraps up an arbitrary Rust Error value as a Dafny Error +pub fn to_opaque_error(value: E) -> + ::std::rc::Rc +{ + let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( + ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), + )); + ::std::rc::Rc::new( + crate::r#simple::types::smithylong::internaldafny::types::Error::Opaque { + obj: error_obj, + }, + ) +} + +/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure +pub fn to_opaque_error_result(value: E) -> + ::std::rc::Rc< + crate::_Wrappers_Compile::Result< + T, + ::std::rc::Rc + > + > +{ + ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: to_opaque_error(value), + }, + ) +} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long.rs index 59558ca19..210e9a6d0 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_input.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_input.rs index 839295972..9b4211a3d 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_input.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_input.rs @@ -1,37 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_long::GetLongInput, ) -> ::std::rc::Rc< crate::r#simple::types::smithylong::internaldafny::types::GetLongInput, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { value: v }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithylong::internaldafny::types::GetLongInput::GetLongInput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::olong_to_dafny(&value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithylong::internaldafny::types::GetLongInput, >, ) -> crate::operation::get_long::GetLongInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(dafny_value.value().Extract()) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_long::GetLongInput { value } + crate::operation::get_long::GetLongInput::builder() + .set_value(crate::standard_library_conversions::olong_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_output.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_output.rs index 68ff34def..4bbf35365 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_output.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_output.rs @@ -1,37 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_long::GetLongOutput, ) -> ::std::rc::Rc< crate::r#simple::types::smithylong::internaldafny::types::GetLongOutput, -> { - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithylong::internaldafny::types::GetLongOutput::GetLongOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::olong_to_dafny(&value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithylong::internaldafny::types::GetLongOutput, >, ) -> crate::operation::get_long::GetLongOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(dafny_value.value().Extract()) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_long::GetLongOutput { value } + crate::operation::get_long::GetLongOutput::builder() + .set_value(crate::standard_library_conversions::olong_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value.rs deleted file mode 100644 index f4c90a3a2..000000000 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -use std::any::Any; - -#[allow(dead_code)] -pub fn to_dafny_error( - value: crate::operation::get_long_known_value::GetLongKnownValueError, -) -> ::std::rc::Rc { - match value { - crate::operation::get_long_known_value::GetLongKnownValueError::Unhandled(unhandled) => - ::std::rc::Rc::new(crate::r#simple::types::smithylong::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) - } -} - -#[allow(dead_code)] -pub fn from_dafny_error( - dafny_value: ::std::rc::Rc< - crate::r#simple::types::smithylong::internaldafny::types::Error, - >, -) -> crate::operation::get_long_known_value::GetLongKnownValueError { - // TODO: Losing information here, but we have to figure out how to wrap an arbitrary Dafny value as std::error::Error - if matches!(&dafny_value.as_ref(), crate::r#simple::types::smithylong::internaldafny::types::Error::CollectionOfErrors { .. }) { - let error_message = "TODO: can't get message yet"; - crate::operation::get_long_known_value::GetLongKnownValueError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) - } else { - crate::operation::get_long_known_value::GetLongKnownValueError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) - } -} - -pub mod _get_long_known_value_input; - -pub mod _get_long_known_value_output; diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_input.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_input.rs deleted file mode 100644 index aae399058..000000000 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_input.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::get_long_known_value::GetLongKnownValueInput, -) -> ::std::rc::Rc< - crate::r#simple::types::smithylong::internaldafny::types::GetLongInput, -> { - let dafny_value = match value.value { - Some(v) => crate::_Wrappers_Compile::Option::Some { value: v }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(crate::r#simple::types::smithylong::internaldafny::types::GetLongInput::GetLongInput { - value: ::std::rc::Rc::new(dafny_value) - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::types::smithylong::internaldafny::types::GetLongInput, - >, -) -> crate::operation::get_long_known_value::GetLongKnownValueInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(dafny_value.value().Extract()) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_long_known_value::GetLongKnownValueInput { value } -} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_output.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_output.rs deleted file mode 100644 index bdc927aae..000000000 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_output.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::get_long_known_value::GetLongKnownValueOutput, -) -> ::std::rc::Rc< - crate::r#simple::types::smithylong::internaldafny::types::GetLongOutput, -> { - let dafny_value = match value.value { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(crate::r#simple::types::smithylong::internaldafny::types::GetLongOutput::GetLongOutput { - value: ::std::rc::Rc::new(dafny_value) - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::types::smithylong::internaldafny::types::GetLongOutput, - >, -) -> crate::operation::get_long_known_value::GetLongKnownValueOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(dafny_value.value().Extract()) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_long_known_value::GetLongKnownValueOutput { value } -} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value_test.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value_test.rs new file mode 100644 index 000000000..5550a2e76 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value_test.rs @@ -0,0 +1,33 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::any::Any; + +#[allow(dead_code)] +pub fn to_dafny_error( + value: crate::operation::get_long_known_value_test::GetLongKnownValueTestError, +) -> ::std::rc::Rc { + match value { + crate::operation::get_long_known_value_test::GetLongKnownValueTestError::Unhandled(unhandled) => + ::std::rc::Rc::new(crate::r#simple::types::smithylong::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) + } +} + +#[allow(dead_code)] +pub fn from_dafny_error( + dafny_value: ::std::rc::Rc< + crate::r#simple::types::smithylong::internaldafny::types::Error, + >, +) -> crate::operation::get_long_known_value_test::GetLongKnownValueTestError { + // TODO: Losing information here, but we have to figure out how to wrap an arbitrary Dafny value as std::error::Error + if matches!(&dafny_value.as_ref(), crate::r#simple::types::smithylong::internaldafny::types::Error::CollectionOfErrors { .. }) { + let error_message = "TODO: can't get message yet"; + crate::operation::get_long_known_value_test::GetLongKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) + } else { + crate::operation::get_long_known_value_test::GetLongKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) + } +} + +pub mod _get_long_known_value_test_input; + +pub mod _get_long_known_value_test_output; diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value_test/_get_long_known_value_test_input.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value_test/_get_long_known_value_test_input.rs new file mode 100644 index 000000000..67c44ec3c --- /dev/null +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value_test/_get_long_known_value_test_input.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::get_long_known_value_test::GetLongInput, +) -> ::std::rc::Rc< + crate::r#simple::types::smithylong::internaldafny::types::GetLongInput, +>{ + ::std::rc::Rc::new(crate::r#simple::types::smithylong::internaldafny::types::GetLongInput::GetLongInput { + value: crate::standard_library_conversions::olong_to_dafny(&value.value), + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::types::smithylong::internaldafny::types::GetLongInput, + >, +) -> crate::operation::get_long_known_value_test::GetLongInput { + crate::operation::get_long_known_value_test::GetLongInput::builder() + .set_value(crate::standard_library_conversions::olong_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() +} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value_test/_get_long_known_value_test_output.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value_test/_get_long_known_value_test_output.rs new file mode 100644 index 000000000..859142fbf --- /dev/null +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value_test/_get_long_known_value_test_output.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::get_long_known_value_test::GetLongOutput, +) -> ::std::rc::Rc< + crate::r#simple::types::smithylong::internaldafny::types::GetLongOutput, +>{ + ::std::rc::Rc::new(crate::r#simple::types::smithylong::internaldafny::types::GetLongOutput::GetLongOutput { + value: crate::standard_library_conversions::olong_to_dafny(&value.value), + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::types::smithylong::internaldafny::types::GetLongOutput, + >, +) -> crate::operation::get_long_known_value_test::GetLongOutput { + crate::operation::get_long_known_value_test::GetLongOutput::builder() + .set_value(crate::standard_library_conversions::olong_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() +} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config.rs index 129c7eb44..644ecd05d 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config.rs @@ -1,3 +1,4 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub mod _simple_long_config; diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config/_simple_long_config.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config/_simple_long_config.rs index 4bb610c4d..1371539ba 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config/_simple_long_config.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config/_simple_long_config.rs @@ -1,10 +1,12 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::types::simple_long_config::SimpleLongConfig, ) -> ::std::rc::Rc< - crate::simple::types::smithylong::internaldafny::types::SimpleLongConfig, + crate::r#simple::types::smithylong::internaldafny::types::SimpleLongConfig, > { ::std::rc::Rc::new(crate::r#simple::types::smithylong::internaldafny::types::SimpleLongConfig::SimpleLongConfig {}) } diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error.rs index ec89cbecc..4cddaa7c3 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use ::aws_smithy_runtime_api::box_error::BoxError; /// Error type returned by the client. diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error/sealed_unhandled.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error/sealed_unhandled.rs index cce22d1cf..eae800729 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error/sealed_unhandled.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error/sealed_unhandled.rs @@ -1,4 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::any::Any; + +use dafny_runtime::UpcastObject; + /// This struct is not intended to be used. /// /// This struct holds information about an unhandled error, @@ -21,6 +27,6 @@ pub struct Unhandled { pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, } -impl ::dafny_runtime::UpcastObject for Unhandled { +impl UpcastObject for Unhandled { ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); } diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/lib.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/lib.rs deleted file mode 100644 index 1248f5830..000000000 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/lib.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![allow(deprecated)] - -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -pub mod client; -pub mod types; - -/// Common errors and error handling utilities. -pub mod error; - -/// All operations that this crate can perform. -pub mod operation; - -mod conversions; - -pub mod implementation_from_dafny; - -pub use client::Client; -pub use types::simple_long_config::SimpleLongConfig; diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation.rs index 937872007..4584907ae 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation.rs @@ -1,7 +1,8 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `GetLong` operation. pub mod get_long; -/// Types for the `GetLongKnownValue` operation. -pub mod get_long_known_value; +/// Types for the `GetLongKnownValueTest` operation. +pub mod get_long_known_value_test; diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long.rs index 44259e5ba..a7387cce9 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetLong`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -16,14 +18,17 @@ impl GetLong { crate::operation::get_long::GetLongError, > { let inner_input = crate::conversions::get_long::_get_long_input::to_dafny(input); - let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()).GetLong(&inner_input); + let inner_result = + ::dafny_runtime::md!(client.dafny_client.clone()).GetLong(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } ) { - Ok(crate::conversions::get_long::_get_long_output::from_dafny( - inner_result.value().clone(), - )) + Ok( + crate::conversions::get_long::_get_long_output::from_dafny( + inner_result.value().clone(), + ), + ) } else { Err(crate::conversions::get_long::from_dafny_error( inner_result.error().clone(), @@ -134,9 +139,9 @@ pub use crate::operation::get_long::_get_long_output::GetLongOutput; pub use crate::operation::get_long::_get_long_input::GetLongInput; -mod _get_long_input; +pub(crate) mod _get_long_output; -mod _get_long_output; +pub(crate) mod _get_long_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_input.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_input.rs index cf4ca97a0..0f9e90cd9 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_input.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_input.rs @@ -1,16 +1,18 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetLongInput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, +pub value: ::std::option::Option<::std::primitive::i64>, } impl GetLongInput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&i64> { - self.value.as_ref() - } +pub fn value(&self) -> ::std::option::Option<::std::primitive::i64> { + self.value +} } impl GetLongInput { /// Creates a new builder-style object to manufacture [`GetLongInput`](crate::operation::operation::GetLongInput). @@ -25,23 +27,23 @@ impl GetLongInput { ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, )] pub struct GetLongInputBuilder { - pub(crate) value: ::std::option::Option, + pub(crate) value: ::std::option::Option<::std::primitive::i64>, } impl GetLongInputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - &self.value - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::i64>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::i64>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::i64> { + &self.value +} /// Consumes the builder and constructs a [`GetLongInput`](crate::operation::operation::GetLongInput). pub fn build( self, @@ -49,6 +51,8 @@ impl GetLongInputBuilder { crate::operation::get_long::GetLongInput, ::aws_smithy_types::error::operation::BuildError, > { - ::std::result::Result::Ok(crate::operation::get_long::GetLongInput { value: self.value }) + ::std::result::Result::Ok(crate::operation::get_long::GetLongInput { + value: self.value, + }) } } diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_output.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_output.rs index 5a2814c68..86950e84c 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_output.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_output.rs @@ -1,19 +1,19 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetLongOutput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, +pub value: ::std::option::Option<::std::primitive::i64>, } - impl GetLongOutput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } +pub fn value(&self) -> ::std::option::Option<::std::primitive::i64> { + self.value +} } - impl GetLongOutput { /// Creates a new builder-style object to manufacture [`GetLongOutput`](crate::operation::operation::GetLongOutput). pub fn builder() -> crate::operation::get_long::builders::GetLongOutputBuilder { @@ -27,27 +27,23 @@ impl GetLongOutput { ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, )] pub struct GetLongOutputBuilder { - pub(crate) value: ::std::option::Option, + pub(crate) value: ::std::option::Option<::std::primitive::i64>, } - impl GetLongOutputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.value = input; - self - } - - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - &self.value - } - +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::i64>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::i64>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::i64> { + &self.value +} /// Consumes the builder and constructs a [`GetLongOutput`](crate::operation::operation::GetLongOutput). pub fn build( self, @@ -55,6 +51,8 @@ impl GetLongOutputBuilder { crate::operation::get_long::GetLongOutput, ::aws_smithy_types::error::operation::BuildError, > { - ::std::result::Result::Ok(crate::operation::get_long::GetLongOutput { value: self.value }) + ::std::result::Result::Ok(crate::operation::get_long::GetLongOutput { + value: self.value, + }) } } diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/builders.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/builders.rs index cf89d6b34..5cdbbd256 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/builders.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/builders.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use crate::operation::get_long::_get_long_output::GetLongOutputBuilder; pub use crate::operation::get_long::_get_long_input::GetLongInputBuilder; @@ -22,7 +24,7 @@ impl GetLongInputBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetLongFluentBuilder { client: crate::client::Client, - inner: crate::operation::get_long::builders::GetLongInputBuilder, + pub(crate) inner: crate::operation::get_long::builders::GetLongInputBuilder, } impl GetLongFluentBuilder { /// Creates a new `GetLong`. @@ -56,17 +58,17 @@ impl GetLongFluentBuilder { } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: i64) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::i64>) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::i64>) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::i64> { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_input.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_input.rs deleted file mode 100644 index b1b4d3bec..000000000 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_input.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetLongKnownValueInput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetLongKnownValueInput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } -} -impl GetLongKnownValueInput { - /// Creates a new builder-style object to manufacture [`GetLongKnownValueInput`](crate::operation::operation::GetLongKnownValueInput). - pub fn builder( - ) -> crate::operation::get_long_known_value::builders::GetLongKnownValueInputBuilder { - crate::operation::get_long_known_value::builders::GetLongKnownValueInputBuilder::default() - } -} - -/// A builder for [`GetLongKnownValueInput`](crate::operation::operation::GetLongKnownValueInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetLongKnownValueInputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetLongKnownValueInputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetLongKnownValueInput`](crate::operation::operation::GetLongKnownValueInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_long_known_value::GetLongKnownValueInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_long_known_value::GetLongKnownValueInput { value: self.value }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_output.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_output.rs deleted file mode 100644 index b18b9c89a..000000000 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_output.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetLongKnownValueOutput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option, -} -impl GetLongKnownValueOutput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option { - self.value - } -} -impl GetLongKnownValueOutput { - /// Creates a new builder-style object to manufacture [`GetLongKnownValueOutput`](crate::operation::operation::GetLongKnownValueOutput). - pub fn builder( - ) -> crate::operation::get_long_known_value::builders::GetLongKnownValueOutputBuilder { - crate::operation::get_long_known_value::builders::GetLongKnownValueOutputBuilder::default() - } -} - -/// A builder for [`GetLongKnownValueOutput`](crate::operation::operation::GetLongKnownValueOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetLongKnownValueOutputBuilder { - pub(crate) value: ::std::option::Option, -} -impl GetLongKnownValueOutputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - &self.value - } - /// Consumes the builder and constructs a [`GetLongKnownValueOutput`](crate::operation::operation::GetLongKnownValueOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_long_known_value::GetLongKnownValueOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_long_known_value::GetLongKnownValueOutput { value: self.value }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/builders.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/builders.rs deleted file mode 100644 index 46a4de5e3..000000000 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/builders.rs +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_long_known_value::_get_long_known_value_output::GetLongKnownValueOutputBuilder; - -pub use crate::operation::get_long_known_value::_get_long_known_value_input::GetLongKnownValueInputBuilder; - -impl GetLongKnownValueInputBuilder { - /// Sends a request with this input using the given client. - pub async fn send_with( - self, - client: &crate::Client, - ) -> ::std::result::Result< - crate::operation::get_long_known_value::GetLongKnownValueOutput, - crate::operation::get_long_known_value::GetLongKnownValueError, - > { - let mut fluent_builder = client.get_long_known_value(); - fluent_builder.inner = self; - fluent_builder.send().await - } -} -/// Fluent builder constructing a request to `GetLongKnownValue`. -/// -#[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct GetLongKnownValueFluentBuilder { - client: crate::client::Client, - inner: crate::operation::get_long_known_value::builders::GetLongKnownValueInputBuilder, -} -impl GetLongKnownValueFluentBuilder { - /// Creates a new `GetLongKnownValue`. - pub(crate) fn new(client: crate::client::Client) -> Self { - Self { - client, - inner: ::std::default::Default::default(), - } - } - /// Access the GetLongKnownValue as a reference. - pub fn as_input( - &self, - ) -> &crate::operation::get_long_known_value::builders::GetLongKnownValueInputBuilder { - &self.inner - } - /// Sends the request and returns the response. - pub async fn send( - self, - ) -> ::std::result::Result< - crate::operation::get_long_known_value::GetLongKnownValueOutput, - crate::operation::get_long_known_value::GetLongKnownValueError, - > { - let input = self - .inner - .build() - // Using unhandled since GetLong doesn't declare any validation, - // and smithy-rs seems to not generate a ValidationError case unless there is - // (but isn't that a backwards compatibility problem for output structures?) - // Vanilla smithy-rs uses SdkError::construction_failure, - // but we aren't using SdkError. - .map_err(crate::operation::get_long_known_value::GetLongKnownValueError::unhandled)?; - crate::operation::get_long_known_value::GetLongKnownValue::send(&self.client, input).await - } - - #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: i64) -> Self { - self.inner = self.inner.value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option { - self.inner.get_value() - } -} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test.rs similarity index 67% rename from TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value.rs rename to TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test.rs index b434182d0..ce1f24b47 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test.rs @@ -1,44 +1,46 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -/// Orchestration and serialization glue logic for `GetLongKnownValue`. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +/// Orchestration and serialization glue logic for `GetLongKnownValueTest`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] -pub struct GetLongKnownValue; -impl GetLongKnownValue { - /// Creates a new `GetLongKnownValue` +pub struct GetLongKnownValueTest; +impl GetLongKnownValueTest { + /// Creates a new `GetLongKnownValueTest` pub fn new() -> Self { Self } pub(crate) async fn send( client: &crate::client::Client, - input: crate::operation::get_long_known_value::GetLongKnownValueInput, + input: crate::operation::get_long_known_value_test::GetLongInput, ) -> ::std::result::Result< - crate::operation::get_long_known_value::GetLongKnownValueOutput, - crate::operation::get_long_known_value::GetLongKnownValueError, + crate::operation::get_long_known_value_test::GetLongOutput, + crate::operation::get_long_known_value_test::GetLongKnownValueTestError, > { - let inner_input = - crate::conversions::get_long_known_value::_get_long_known_value_input::to_dafny(input); - let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()).GetLong(&inner_input); + let inner_input = crate::conversions::get_long_known_value_test::_get_long_known_value_test_input::to_dafny(input); + let inner_result = + ::dafny_runtime::md!(client.dafny_client.clone()).GetLongKnownValueTest(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } ) { Ok( - crate::conversions::get_long_known_value::_get_long_known_value_output::from_dafny( + crate::conversions::get_long_known_value_test::_get_long_known_value_test_output::from_dafny( inner_result.value().clone(), ), ) } else { - Err(crate::conversions::get_long_known_value::from_dafny_error( + Err(crate::conversions::get_long_known_value_test::from_dafny_error( inner_result.error().clone(), )) } } } -/// Error type for the `GetLongKnownValue` operation. +/// Error type for the `GetLongKnownValueTest` operation. #[non_exhaustive] #[derive(::std::fmt::Debug)] -pub enum GetLongKnownValueError { +pub enum GetLongKnownValueTestError { /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). #[deprecated( note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ @@ -46,12 +48,12 @@ pub enum GetLongKnownValueError { \    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` \ - See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetLongKnownValueError) for what information is available for the error." + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetLongKnownValueTestError) for what information is available for the error." )] Unhandled(crate::error::sealed_unhandled::Unhandled), } -impl GetLongKnownValueError { - /// Creates the `GetLongKnownValueError::Unhandled` variant from any error type. +impl GetLongKnownValueTestError { + /// Creates the `GetLongKnownValueTestError::Unhandled` variant from any error type. pub fn unhandled( err: impl ::std::convert::Into< ::std::boxed::Box< @@ -65,7 +67,7 @@ impl GetLongKnownValueError { }) } - /// Creates the `GetLongKnownValueError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + /// Creates the `GetLongKnownValueTestError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), @@ -82,14 +84,14 @@ impl GetLongKnownValueError { } } } -impl ::std::error::Error for GetLongKnownValueError { +impl ::std::error::Error for GetLongKnownValueTestError { fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { match self { Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source), } } } -impl ::std::fmt::Display for GetLongKnownValueError { +impl ::std::fmt::Display for GetLongKnownValueTestError { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match self { Self::Unhandled(_inner) => { @@ -104,7 +106,7 @@ impl ::std::fmt::Display for GetLongKnownValueError { } } } -impl ::aws_smithy_types::retry::ProvideErrorKind for GetLongKnownValueError { +impl ::aws_smithy_types::retry::ProvideErrorKind for GetLongKnownValueTestError { fn code(&self) -> ::std::option::Option<&str> { ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) } @@ -112,14 +114,14 @@ impl ::aws_smithy_types::retry::ProvideErrorKind for GetLongKnownValueError { ::std::option::Option::None } } -impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetLongKnownValueError { +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetLongKnownValueTestError { fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { match self { Self::Unhandled(_inner) => &_inner.meta, } } } -impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetLongKnownValueError { +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetLongKnownValueTestError { fn create_unhandled_error( source: ::std::boxed::Box< dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, @@ -133,13 +135,13 @@ impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetLongK } } -pub use crate::operation::get_long_known_value::_get_long_known_value_output::GetLongKnownValueOutput; +pub use crate::operation::get_long_known_value_test::_get_long_output::GetLongOutput; -pub use crate::operation::get_long_known_value::_get_long_known_value_input::GetLongKnownValueInput; +pub use crate::operation::get_long_known_value_test::_get_long_input::GetLongInput; -mod _get_long_known_value_input; +pub(crate) mod _get_long_output; -mod _get_long_known_value_output; +pub(crate) mod _get_long_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test/_get_long_input.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test/_get_long_input.rs new file mode 100644 index 000000000..3549b7255 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test/_get_long_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetLongInput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option<::std::primitive::i64>, +} +impl GetLongInput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option<::std::primitive::i64> { + self.value +} +} +impl GetLongInput { + /// Creates a new builder-style object to manufacture [`GetLongInput`](crate::operation::operation::GetLongInput). + pub fn builder() -> crate::operation::get_long_known_value_test::builders::GetLongInputBuilder { + crate::operation::get_long_known_value_test::builders::GetLongInputBuilder::default() + } +} + +/// A builder for [`GetLongInput`](crate::operation::operation::GetLongInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetLongInputBuilder { + pub(crate) value: ::std::option::Option<::std::primitive::i64>, +} +impl GetLongInputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::i64>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::i64>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::i64> { + &self.value +} + /// Consumes the builder and constructs a [`GetLongInput`](crate::operation::operation::GetLongInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_long_known_value_test::GetLongInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_long_known_value_test::GetLongInput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test/_get_long_output.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test/_get_long_output.rs new file mode 100644 index 000000000..60d05a148 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test/_get_long_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetLongOutput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option<::std::primitive::i64>, +} +impl GetLongOutput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option<::std::primitive::i64> { + self.value +} +} +impl GetLongOutput { + /// Creates a new builder-style object to manufacture [`GetLongOutput`](crate::operation::operation::GetLongOutput). + pub fn builder() -> crate::operation::get_long_known_value_test::builders::GetLongOutputBuilder { + crate::operation::get_long_known_value_test::builders::GetLongOutputBuilder::default() + } +} + +/// A builder for [`GetLongOutput`](crate::operation::operation::GetLongOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetLongOutputBuilder { + pub(crate) value: ::std::option::Option<::std::primitive::i64>, +} +impl GetLongOutputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::i64>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::i64>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::i64> { + &self.value +} + /// Consumes the builder and constructs a [`GetLongOutput`](crate::operation::operation::GetLongOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_long_known_value_test::GetLongOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_long_known_value_test::GetLongOutput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test/builders.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test/builders.rs new file mode 100644 index 000000000..a79b8a361 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value_test/builders.rs @@ -0,0 +1,74 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::get_long_known_value_test::_get_long_output::GetLongOutputBuilder; + +pub use crate::operation::get_long_known_value_test::_get_long_input::GetLongInputBuilder; + +impl GetLongInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with( + self, + client: &crate::Client, + ) -> ::std::result::Result< + crate::operation::get_long_known_value_test::GetLongOutput, + crate::operation::get_long_known_value_test::GetLongKnownValueTestError, + > { + let mut fluent_builder = client.get_long_known_value_test(); + fluent_builder.inner = self; + fluent_builder.send().await + } +} +/// Fluent builder constructing a request to `GetLongKnownValueTest`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct GetLongKnownValueTestFluentBuilder { + client: crate::client::Client, + pub(crate) inner: crate::operation::get_long_known_value_test::builders::GetLongInputBuilder, +} +impl GetLongKnownValueTestFluentBuilder { + /// Creates a new `GetLongKnownValueTest`. + pub(crate) fn new(client: crate::client::Client) -> Self { + Self { + client, + inner: ::std::default::Default::default(), + } + } + /// Access the GetLongKnownValueTest as a reference. + pub fn as_input(&self) -> &crate::operation::get_long_known_value_test::builders::GetLongInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + pub async fn send( + self, + ) -> ::std::result::Result< + crate::operation::get_long_known_value_test::GetLongOutput, + crate::operation::get_long_known_value_test::GetLongKnownValueTestError, + > { + let input = self + .inner + .build() + // Using unhandled since GetLongKnownValueTest doesn't declare any validation, + // and smithy-rs seems to not generate a ValidationError case unless there is + // (but isn't that a backwards compatibility problem for output structures?) + // Vanilla smithy-rs uses SdkError::construction_failure, + // but we aren't using SdkError. + .map_err(crate::operation::get_long_known_value_test::GetLongKnownValueTestError::unhandled)?; + crate::operation::get_long_known_value_test::GetLongKnownValueTest::send(&self.client, input).await + } + + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::i64>) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::primitive::i64>) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::primitive::i64> { + self.inner.get_value() +} +} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/standard_library_conversions.rs index 3a51134c6..6bf8297d8 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/standard_library_conversions.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/standard_library_conversions.rs @@ -1,246 +1,266 @@ pub fn ostring_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, > { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) - }, - None => crate::_Wrappers_Compile::Option::None {}, + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) + }, + None => crate::_Wrappers_Compile::Option::None {}, }; - ::std::rc::Rc::new(dafny_value) + ::std::rc::Rc::new(dafny_value) } pub fn ostring_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, - >, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input.Extract(), - ), - ) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some( + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input.Extract(), + ), + ) + } else { + None + } } -pub fn obool_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn obool_to_dafny( + input: &Option, +) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn obool_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn obool_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn olong_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn olong_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn olong_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn blob_to_dafny( - input: &::aws_smithy_types::Blob, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) +pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) } pub fn oblob_to_dafny( - input: &Option<::aws_smithy_types::Blob>, + input: &Option<::aws_smithy_types::Blob>, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: blob_to_dafny(&b), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { + value: blob_to_dafny(&b), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn blob_from_dafny( - input: ::dafny_runtime::Sequence, -) -> ::aws_smithy_types::Blob { - - ::aws_smithy_types::Blob::new( - ::std::rc::Rc::try_unwrap(input.to_array()) - .unwrap_or_else(|rc| (*rc).clone()), - ) +pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { + ::aws_smithy_types::Blob::new( + ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), + ) } pub fn oblob_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option<::aws_smithy_types::Blob> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(blob_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(blob_from_dafny(input.Extract())) + } else { + None + } } -pub fn double_to_dafny( - input: f64, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( - &f64::to_be_bytes(input).to_vec(), - |x| *x) +pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( + &f64::to_be_bytes(input).to_vec(), + |x| *x, + ) } pub fn odouble_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: double_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: double_to_dafny(*f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn double_from_dafny( - input: &::dafny_runtime::Sequence, -) -> f64 { - let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); - f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) +pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { + let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); + f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) } pub fn odouble_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(double_from_dafny(&input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(double_from_dafny(&input.Extract())) + } else { + None + } } pub fn timestamp_to_dafny( - input: ::aws_smithy_types::DateTime, + input: &::aws_smithy_types::DateTime, ) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&input.to_string()) + ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &input.to_string(), + ) } pub fn otimestamp_to_dafny( - input: &Option<::aws_smithy_types::DateTime>, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: timestamp_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + input: &Option<::aws_smithy_types::DateTime>, +) -> ::std::rc::Rc< + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, +> { + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: timestamp_to_dafny(f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn timestamp_from_dafny( - input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, ) -> ::aws_smithy_types::DateTime { - let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&input); - ::aws_smithy_types::DateTime::from_str( - &s, - aws_smithy_types::date_time::Format::DateTime, - ).unwrap() + let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input, + ); + ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) + .unwrap() } pub fn otimestamp_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option<::aws_smithy_types::DateTime> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(timestamp_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(timestamp_from_dafny(input.Extract())) + } else { + None + } } pub fn option_from_dafny( - input: ::std::rc::Rc>, - converter: fn(&T) -> TR, + input: ::std::rc::Rc>, + converter: fn(&T) -> TR, ) -> Option { - match &*input { - crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), - crate::_Wrappers_Compile::Option::None { } => None, - } + match &*input { + crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), + crate::_Wrappers_Compile::Option::None {} => None, + } } pub fn option_to_dafny( - input: &Option, - converter: fn(&TR) -> T, + input: &Option, + converter: fn(&TR) -> T, ) -> ::std::rc::Rc> { - match input { - Some(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::Some { - value: converter(&value) - } - ), - None => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::None {} - ), - } + match input { + Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { + value: converter(&value), + }), + None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), + } } pub fn result_from_dafny( - input: ::std::rc::Rc>, - converter_t: fn(&T) -> TR, - converter_e: fn(&E) -> ER, + input: ::std::rc::Rc>, + converter_t: fn(&T) -> TR, + converter_e: fn(&E) -> ER, ) -> Result { - match &*input { - crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), - crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), - } + match &*input { + crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), + crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), + } } pub fn result_to_dafny( - input: &Result, - converter_t: fn(&TR) -> T, - converter_e: fn(&ER) -> E, + input: &Result, + converter_t: fn(&TR) -> T, + converter_e: fn(&ER) -> E, ) -> ::std::rc::Rc> { - match input { - Ok(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: converter_t(&value) - } - ), - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: converter_e(&error) - } - ), - } -} \ No newline at end of file + match input { + Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { + value: converter_t(&value), + }), + Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { + error: converter_e(&error), + }), + } +} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/standard_library_externs.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types.rs index f8ff6d665..d9223fcb3 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types.rs @@ -1,4 +1,5 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `SimpleLongConfig` pub mod simple_long_config; diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types/simple_long_config.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types/simple_long_config.rs index 7def54c03..5df8e1ebf 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types/simple_long_config.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types/simple_long_config.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct SimpleLongConfig {} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/wrapped.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/wrapped.rs new file mode 100644 index 000000000..ef8910b03 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/wrapped.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod client; + +impl crate::r#simple::types::smithylong::internaldafny::wrapped::_default { + pub fn WrappedSimpleLong(config: &::std::rc::Rc< + crate::r#simple::types::smithylong::internaldafny::types::SimpleLongConfig, + >) -> ::std::rc::Rc, + ::std::rc::Rc + >>{ + crate::wrapped::client::Client::from_conf(config) + } +} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/wrapped/client.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/wrapped/client.rs new file mode 100644 index 000000000..5b4a2bf9c --- /dev/null +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/wrapped/client.rs @@ -0,0 +1,119 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use tokio::runtime::Runtime; + +pub struct Client { + wrapped: crate::client::Client, + + /// A `current_thread` runtime for executing operations on the + /// asynchronous client in a blocking manner. + rt: Runtime +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn crate::r#simple::types::smithylong::internaldafny::types::ISimpleTypesLongClient); +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); +} + +impl Client { + pub fn from_conf(config: &::std::rc::Rc< + crate::r#simple::types::smithylong::internaldafny::types::SimpleLongConfig, + >) -> +::std::rc::Rc, + ::std::rc::Rc +>> { + let rt_result = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build(); + let rt = match rt_result { + Ok(x) => x, + Err(error) => return crate::conversions::error::to_opaque_error_result(error), + }; + let result = crate::client::Client::from_conf( + crate::conversions::simple_long_config::_simple_long_config::from_dafny( + config.clone(), + ), + ); + match result { + Ok(client) => { + let wrap = crate::wrapped::client::Client { + wrapped: client, + rt + }; + std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(wrap)) + } + ) + }, + Err(error) => crate::conversions::error::to_opaque_error_result(error) + } + } +} + +impl crate::r#simple::types::smithylong::internaldafny::types::ISimpleTypesLongClient for Client { + fn GetLong( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::smithylong::internaldafny::types::GetLongInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::smithylong::internaldafny::types::GetLongOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_long::_get_long_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_long::GetLong::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_long::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_long::_get_long_output::to_dafny(client), + }, + ), + } + } + + fn GetLongKnownValueTest( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::smithylong::internaldafny::types::GetLongInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::smithylong::internaldafny::types::GetLongOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_long_known_value_test::_get_long_known_value_test_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_long_known_value_test::GetLongKnownValueTest::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_long_known_value_test::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_long_known_value_test::_get_long_known_value_test_output::to_dafny(client), + }, + ), + } + } +} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/tests/simple_long_test.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/tests/simple_long_test.rs index d63548ae6..e48d52d5f 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/tests/simple_long_test.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/tests/simple_long_test.rs @@ -10,7 +10,7 @@ async fn test_get_long() { #[tokio::test] async fn test_get_known_value() { - let result = client().get_long_known_value().value(33i64).send().await; + let result = client().get_long_known_value_test().value(33i64).send().await; let output = result.unwrap(); let value = output.value().unwrap(); assert_eq!(value, 33i64); diff --git a/TestModels/SimpleTypes/SimpleString/Makefile b/TestModels/SimpleTypes/SimpleString/Makefile index 549a8995d..8bcdf25d3 100644 --- a/TestModels/SimpleTypes/SimpleString/Makefile +++ b/TestModels/SimpleTypes/SimpleString/Makefile @@ -3,8 +3,9 @@ CORES=2 +TRANSPILE_TESTS_IN_RUST=1 + ENABLE_EXTERN_PROCESSING=1 -RUST_BENERATED=1 include ../../SharedMakefile.mk diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/Cargo.toml b/TestModels/SimpleTypes/SimpleString/runtimes/rust/Cargo.toml index 3f66bd6aa..65ef7a396 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/Cargo.toml +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/Cargo.toml @@ -5,15 +5,21 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +wrapped-client = [] + [dependencies] aws-smithy-runtime = {version = "1.6.0", features = ["client"] } aws-smithy-runtime-api = {version = "1.7.0", features = ["client"] } aws-smithy-types = "1.2.0" dafny_runtime = { path = "../../../../dafny-dependencies/dafny_runtime_rust"} -[dev-dependencies.tokio] +[dev-dependencies] +simple_string = { path = ".", features = ["wrapped-client"] } + +[dependencies.tokio] version = "1.26.0" features = ["full"] [lib] -path = "src/implementation_from_dafny.rs" \ No newline at end of file +path = "src/implementation_from_dafny.rs" diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client.rs index 2d5b76bf2..88a144918 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use aws_smithy_types::error::operation::BuildError; #[derive(::std::clone::Clone, ::std::fmt::Debug)] @@ -13,8 +14,6 @@ impl Client { pub fn from_conf( conf: crate::types::simple_string_config::SimpleStringConfig, ) -> Result { - // If this service had any configuration properties, - // they would need converting here too. let inner = crate::simple::types::smithystring::internaldafny::_default::SimpleString( &crate::conversions::simple_string_config::_simple_string_config::to_dafny(conf), @@ -31,7 +30,7 @@ impl Client { )); } Ok(Self { - dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), + dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) }) } } @@ -42,4 +41,4 @@ mod get_string_known_value; mod get_string_utf8; -mod get_string_utf8_known_value; \ No newline at end of file +mod get_string_utf8_known_value; diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string.rs index da262534e..fe18db0b8 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string.rs @@ -1,11 +1,13 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { /// Constructs a fluent builder for the [`GetString`](crate::operation::get_string::builders::GetStringFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(impl Into>)`](crate::operation::get_string::builders::GetStringFluentBuilder::name) / [`set_name(Option)`](crate::operation::get_string::builders::GetStringFluentBuilder::set_name):(undocumented)
+ /// - [`value(impl Into>)`](crate::operation::get_string::builders::GetStringFluentBuilder::value) / [`set_value(Option<::std::string::String>)`](crate::operation::get_string::builders::GetStringFluentBuilder::set_value): (undocumented)
/// - On success, responds with [`GetStringOutput`](crate::operation::get_string::GetStringOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_string::GetStringOutput::value): (undocumented) + /// - [`value(Option<::std::string::String>)`](crate::operation::get_string::GetStringOutput::value): (undocumented) /// - On failure, responds with [`SdkError`](crate::operation::get_string::GetStringError) pub fn get_string(&self) -> crate::operation::get_string::builders::GetStringFluentBuilder { crate::operation::get_string::builders::GetStringFluentBuilder::new(self.clone()) diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_known_value.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_known_value.rs index 8c13c6ad5..6ddfcadaa 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_known_value.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_known_value.rs @@ -1,17 +1,15 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { /// Constructs a fluent builder for the [`GetStringKnownValue`](crate::operation::get_string_known_value::builders::GetStringKnownValueFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(impl Into>)`](crate::operation::get_string_known_value::builders::GetStringKnownValueFluentBuilder::name) / [`set_name(Option)`](crate::operation::get_string_known_value::builders::GetStringKnownValueFluentBuilder::set_name):(undocumented)
- /// - On success, responds with [`GetStringKnownValueOutput`](crate::operation::get_string_known_value::GetStringKnownValueOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_string_known_value::GetStringKnownValueOutput::value): (undocumented) + /// - [`value(impl Into>)`](crate::operation::get_string_known_value::builders::GetStringKnownValueFluentBuilder::value) / [`set_value(Option<::std::string::String>)`](crate::operation::get_string_known_value::builders::GetStringKnownValueFluentBuilder::set_value): (undocumented)
+ /// - On success, responds with [`GetStringOutput`](crate::operation::get_string_known_value::GetStringOutput) with field(s): + /// - [`value(Option<::std::string::String>)`](crate::operation::get_string_known_value::GetStringOutput::value): (undocumented) /// - On failure, responds with [`SdkError`](crate::operation::get_string_known_value::GetStringKnownValueError) - pub fn get_string_known_value( - &self, - ) -> crate::operation::get_string_known_value::builders::GetStringKnownValueFluentBuilder { - crate::operation::get_string_known_value::builders::GetStringKnownValueFluentBuilder::new( - self.clone(), - ) + pub fn get_string_known_value(&self) -> crate::operation::get_string_known_value::builders::GetStringKnownValueFluentBuilder { + crate::operation::get_string_known_value::builders::GetStringKnownValueFluentBuilder::new(self.clone()) } } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_utf8.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_utf8.rs index 3a487be09..010a0547e 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_utf8.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_utf8.rs @@ -1,15 +1,15 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { /// Constructs a fluent builder for the [`GetStringUTF8`](crate::operation::get_string_utf8::builders::GetStringUTF8FluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(impl Into>)`](crate::operation::get_string_utf8::builders::GetStringUTF8FluentBuilder::name) / [`set_name(Option)`](crate::operation::get_string_utf8::builders::GetStringUTF8FluentBuilder::set_name):(undocumented)
+ /// - [`value(impl Into>)`](crate::operation::get_string_utf8::builders::GetStringUTF8FluentBuilder::value) / [`set_value(Option<::std::string::String>)`](crate::operation::get_string_utf8::builders::GetStringUTF8FluentBuilder::set_value): (undocumented)
/// - On success, responds with [`GetStringUTF8Output`](crate::operation::get_string_utf8::GetStringUTF8Output) with field(s): - /// - [`value(Option)`](crate::operation::get_string_utf8::GetStringUTF8Output::value): (undocumented) + /// - [`value(Option<::std::string::String>)`](crate::operation::get_string_utf8::GetStringUTF8Output::value): (undocumented) /// - On failure, responds with [`SdkError`](crate::operation::get_string_utf8::GetStringUTF8Error) - pub fn get_string_utf8( - &self, - ) -> crate::operation::get_string_utf8::builders::GetStringUTF8FluentBuilder { + pub fn get_string_utf8(&self) -> crate::operation::get_string_utf8::builders::GetStringUTF8FluentBuilder { crate::operation::get_string_utf8::builders::GetStringUTF8FluentBuilder::new(self.clone()) } } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_utf8_known_value.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_utf8_known_value.rs index 205f24ff5..dab2fd15f 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_utf8_known_value.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_utf8_known_value.rs @@ -1,15 +1,15 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { /// Constructs a fluent builder for the [`GetStringUTF8KnownValue`](crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(impl Into>)`](crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueFluentBuilder::name) / [`set_name(Option)`](crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueFluentBuilder::set_name):(undocumented)
- /// - On success, responds with [`GetStringUTF8KnownValueOutput`](crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueOutput::value): (undocumented) + /// - [`value(impl Into>)`](crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueFluentBuilder::value) / [`set_value(Option<::std::string::String>)`](crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueFluentBuilder::set_value): (undocumented)
+ /// - On success, responds with [`GetStringUTF8Output`](crate::operation::get_string_utf8_known_value::GetStringUTF8Output) with field(s): + /// - [`value(Option<::std::string::String>)`](crate::operation::get_string_utf8_known_value::GetStringUTF8Output::value): (undocumented) /// - On failure, responds with [`SdkError`](crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueError) - pub fn get_string_utf8_known_value( - &self, - ) -> crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueFluentBuilder { + pub fn get_string_utf8_known_value(&self) -> crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueFluentBuilder { crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueFluentBuilder::new(self.clone()) } } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions.rs index e48982f58..c994c2ec1 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions.rs @@ -1,10 +1,14 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub mod get_string; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod error; -pub mod get_string_known_value; + pub mod get_string; -pub mod get_string_utf8; + pub mod get_string_known_value; -pub mod get_string_utf8_known_value; + pub mod get_string_utf8; -pub mod simple_string_config; + pub mod get_string_utf8_known_value; + + pub mod simple_string_config; diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/error.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/error.rs new file mode 100644 index 000000000..ec72eaf96 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/error.rs @@ -0,0 +1,32 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + /// Wraps up an arbitrary Rust Error value as a Dafny Error +pub fn to_opaque_error(value: E) -> + ::std::rc::Rc +{ + let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( + ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), + )); + ::std::rc::Rc::new( + crate::r#simple::types::smithystring::internaldafny::types::Error::Opaque { + obj: error_obj, + }, + ) +} + +/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure +pub fn to_opaque_error_result(value: E) -> + ::std::rc::Rc< + crate::_Wrappers_Compile::Result< + T, + ::std::rc::Rc + > + > +{ + ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: to_opaque_error(value), + }, + ) +} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string.rs index 4a11ce932..28eedb416 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string.rs @@ -1,12 +1,12 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] pub fn to_dafny_error( value: crate::operation::get_string::GetStringError, -) -> ::std::rc::Rc -{ +) -> ::std::rc::Rc { match value { crate::operation::get_string::GetStringError::Unhandled(unhandled) => ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_input.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_input.rs index 2b7ac1e68..504704b4f 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_input.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_input.rs @@ -1,43 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_string::GetStringInput, ) -> ::std::rc::Rc< crate::r#simple::types::smithystring::internaldafny::types::GetStringInput, -> { - let dafny_value = match value.value { - Some(s) => crate::_Wrappers_Compile::Option::Some { - value: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::GetStringInput::GetStringInput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::ostring_to_dafny(&value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithystring::internaldafny::types::GetStringInput, >, ) -> crate::operation::get_string::GetStringInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_string::GetStringInput { value } + crate::operation::get_string::GetStringInput::builder() + .set_value(crate::standard_library_conversions::ostring_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_output.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_output.rs index 66cfd6061..9f993cd58 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_output.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_output.rs @@ -1,41 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_string::GetStringOutput, ) -> ::std::rc::Rc< crate::r#simple::types::smithystring::internaldafny::types::GetStringOutput, -> { - let dafny_value = match value.value { - Some(s) => crate::_Wrappers_Compile::Option::Some { - value: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::GetStringOutput::GetStringOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::ostring_to_dafny(&value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( - dafny_value: ::std::rc::Rc, + dafny_value: ::std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::GetStringOutput, + >, ) -> crate::operation::get_string::GetStringOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_string::GetStringOutput { value } + crate::operation::get_string::GetStringOutput::builder() + .set_value(crate::standard_library_conversions::ostring_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value.rs index 680fd6ad8..9f4018f6f 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value.rs @@ -1,12 +1,12 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] pub fn to_dafny_error( value: crate::operation::get_string_known_value::GetStringKnownValueError, -) -> ::std::rc::Rc -{ +) -> ::std::rc::Rc { match value { crate::operation::get_string_known_value::GetStringKnownValueError::Unhandled(unhandled) => ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_input.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_input.rs index 2a638911d..cc34124d8 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_input.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_input.rs @@ -1,43 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_string_known_value::GetStringKnownValueInput, + value: crate::operation::get_string_known_value::GetStringInput, ) -> ::std::rc::Rc< crate::r#simple::types::smithystring::internaldafny::types::GetStringInput, -> { - let dafny_value = match value.value { - Some(s) => crate::_Wrappers_Compile::Option::Some { - value: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::GetStringInput::GetStringInput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::ostring_to_dafny(&value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithystring::internaldafny::types::GetStringInput, >, -) -> crate::operation::get_string_known_value::GetStringKnownValueInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_string_known_value::GetStringKnownValueInput { value } +) -> crate::operation::get_string_known_value::GetStringInput { + crate::operation::get_string_known_value::GetStringInput::builder() + .set_value(crate::standard_library_conversions::ostring_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_output.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_output.rs index 00f53c20b..1507eeb3f 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_output.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_output.rs @@ -1,41 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_string_known_value::GetStringKnownValueOutput, + value: crate::operation::get_string_known_value::GetStringOutput, ) -> ::std::rc::Rc< crate::r#simple::types::smithystring::internaldafny::types::GetStringOutput, -> { - let dafny_value = match value.value { - Some(s) => crate::_Wrappers_Compile::Option::Some { - value: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::GetStringOutput::GetStringOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::ostring_to_dafny(&value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( - dafny_value: ::std::rc::Rc, -) -> crate::operation::get_string_known_value::GetStringKnownValueOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &dafny_value.value().Extract(), - ), - ) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_string_known_value::GetStringKnownValueOutput { value } + dafny_value: ::std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::GetStringOutput, + >, +) -> crate::operation::get_string_known_value::GetStringOutput { + crate::operation::get_string_known_value::GetStringOutput::builder() + .set_value(crate::standard_library_conversions::ostring_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8.rs index 1f3d581ec..855e9697c 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8.rs @@ -1,12 +1,12 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] pub fn to_dafny_error( value: crate::operation::get_string_utf8::GetStringUTF8Error, -) -> ::std::rc::Rc -{ +) -> ::std::rc::Rc { match value { crate::operation::get_string_utf8::GetStringUTF8Error::Unhandled(unhandled) => ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_input.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_input.rs index c6b8fc2ae..c70b83f7b 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_input.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_input.rs @@ -1,43 +1,30 @@ -use core::str; - -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_string_utf8::GetStringUTF8Input, ) -> ::std::rc::Rc< crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Input, -> { - let dafny_value = match value.value { - Some(s) => crate::_Wrappers_Compile::Option::Some { - value: dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&s.as_bytes().to_vec(), |b| *b) - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Input::GetStringUTF8Input { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match value.value { + Some(s) => crate::_Wrappers_Compile::Option::Some { value: dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&s.as_bytes().to_vec(), |b| *b) }, + None => crate::_Wrappers_Compile::Option::None {}, +}), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Input, >, ) -> crate::operation::get_string_utf8::GetStringUTF8Input { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - let bytes = dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec( - &dafny_value.value().Extract(), |b| *b); - Some(String::from_utf8(bytes).unwrap()) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_string_utf8::GetStringUTF8Input { value } + crate::operation::get_string_utf8::GetStringUTF8Input::builder() + .set_value(match dafny_value.value().as_ref() { + crate::_Wrappers_Compile::Option::Some { .. } => ::std::option::Option::Some(::std::string::String::from_utf8(dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&dafny_value.value().Extract(), |b| *b)).unwrap()), + _ => ::std::option::Option::None, +}) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_output.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_output.rs index 1ceb81a53..be225b618 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_output.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_output.rs @@ -1,39 +1,30 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_string_utf8::GetStringUTF8Output, ) -> ::std::rc::Rc< - crate::r#simple::types::smithystring::internaldafny::types::GetStringOutput, -> { - let dafny_value = match value.value { - Some(s) => crate::_Wrappers_Compile::Option::Some { - value: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::GetStringOutput::GetStringOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Output, +>{ + ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Output::GetStringUTF8Output { + value: ::std::rc::Rc::new(match value.value { + Some(s) => crate::_Wrappers_Compile::Option::Some { value: dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&s.as_bytes().to_vec(), |b| *b) }, + None => crate::_Wrappers_Compile::Option::None {}, +}), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( - dafny_value: ::std::rc::Rc, + dafny_value: ::std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Output, + >, ) -> crate::operation::get_string_utf8::GetStringUTF8Output { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - let bytes = dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec( - &dafny_value.value().Extract(), |b| *b); - Some(String::from_utf8(bytes).unwrap()) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_string_utf8::GetStringUTF8Output { value } + crate::operation::get_string_utf8::GetStringUTF8Output::builder() + .set_value(match dafny_value.value().as_ref() { + crate::_Wrappers_Compile::Option::Some { .. } => ::std::option::Option::Some(::std::string::String::from_utf8(dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&dafny_value.value().Extract(), |b| *b)).unwrap()), + _ => ::std::option::Option::None, +}) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8_known_value.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8_known_value.rs index f942e0b21..25e02541c 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8_known_value.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8_known_value.rs @@ -1,12 +1,12 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] pub fn to_dafny_error( value: crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueError, -) -> ::std::rc::Rc -{ +) -> ::std::rc::Rc { match value { crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueError::Unhandled(unhandled) => ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8_known_value/_get_string_utf8_known_value_input.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8_known_value/_get_string_utf8_known_value_input.rs index 97719cd80..233ffd080 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8_known_value/_get_string_utf8_known_value_input.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8_known_value/_get_string_utf8_known_value_input.rs @@ -1,43 +1,30 @@ -use core::str; - -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueInput, + value: crate::operation::get_string_utf8_known_value::GetStringUTF8Input, ) -> ::std::rc::Rc< crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Input, -> { - let dafny_value = match value.value { - Some(s) => crate::_Wrappers_Compile::Option::Some { - value: dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&s.as_bytes().to_vec(), |b| *b) - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Input::GetStringUTF8Input { - value: ::std::rc::Rc::new(dafny_value) - }) + value: ::std::rc::Rc::new(match value.value { + Some(s) => crate::_Wrappers_Compile::Option::Some { value: dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&s.as_bytes().to_vec(), |b| *b) }, + None => crate::_Wrappers_Compile::Option::None {}, +}), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Input, >, -) -> crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueInput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - let bytes = dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec( - &dafny_value.value().Extract(), |b| *b); - Some(String::from_utf8(bytes).unwrap()) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueInput { value } +) -> crate::operation::get_string_utf8_known_value::GetStringUTF8Input { + crate::operation::get_string_utf8_known_value::GetStringUTF8Input::builder() + .set_value(match dafny_value.value().as_ref() { + crate::_Wrappers_Compile::Option::Some { .. } => ::std::option::Option::Some(::std::string::String::from_utf8(dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&dafny_value.value().Extract(), |b| *b)).unwrap()), + _ => ::std::option::Option::None, +}) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8_known_value/_get_string_utf8_known_value_output.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8_known_value/_get_string_utf8_known_value_output.rs index 2f0ea0713..2aa9d94c0 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8_known_value/_get_string_utf8_known_value_output.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8_known_value/_get_string_utf8_known_value_output.rs @@ -1,39 +1,30 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( - value: crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueOutput, + value: crate::operation::get_string_utf8_known_value::GetStringUTF8Output, ) -> ::std::rc::Rc< - crate::r#simple::types::smithystring::internaldafny::types::GetStringOutput, -> { - let dafny_value = match value.value { - Some(s) => crate::_Wrappers_Compile::Option::Some { - value: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::GetStringOutput::GetStringOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Output, +>{ + ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Output::GetStringUTF8Output { + value: ::std::rc::Rc::new(match value.value { + Some(s) => crate::_Wrappers_Compile::Option::Some { value: dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&s.as_bytes().to_vec(), |b| *b) }, + None => crate::_Wrappers_Compile::Option::None {}, +}), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( - dafny_value: ::std::rc::Rc, -) -> crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueOutput { - let value = if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - let bytes = dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec( - &dafny_value.value().Extract(), |b| *b); - Some(String::from_utf8(bytes).unwrap()) - } else if matches!( - dafny_value.value().as_ref(), - crate::_Wrappers_Compile::Option::None { .. } - ) { - None - } else { - panic!("Unreachable") - }; - crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueOutput { value } + dafny_value: ::std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Output, + >, +) -> crate::operation::get_string_utf8_known_value::GetStringUTF8Output { + crate::operation::get_string_utf8_known_value::GetStringUTF8Output::builder() + .set_value(match dafny_value.value().as_ref() { + crate::_Wrappers_Compile::Option::Some { .. } => ::std::option::Option::Some(::std::string::String::from_utf8(dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&dafny_value.value().Extract(), |b| *b)).unwrap()), + _ => ::std::option::Option::None, +}) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config.rs index 286313ae8..d8734a9d1 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config.rs @@ -1,3 +1,4 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub mod _simple_string_config; diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config/_simple_string_config.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config/_simple_string_config.rs index 95d7da8d4..71f90a271 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config/_simple_string_config.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config/_simple_string_config.rs @@ -1,10 +1,12 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::types::simple_string_config::SimpleStringConfig, ) -> ::std::rc::Rc< - crate::simple::types::smithystring::internaldafny::types::SimpleStringConfig, + crate::r#simple::types::smithystring::internaldafny::types::SimpleStringConfig, > { ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::SimpleStringConfig::SimpleStringConfig {}) } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error.rs index ec89cbecc..4cddaa7c3 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use ::aws_smithy_runtime_api::box_error::BoxError; /// Error type returned by the client. diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error/sealed_unhandled.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error/sealed_unhandled.rs index cce22d1cf..eae800729 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error/sealed_unhandled.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error/sealed_unhandled.rs @@ -1,4 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::any::Any; + +use dafny_runtime::UpcastObject; + /// This struct is not intended to be used. /// /// This struct holds information about an unhandled error, @@ -21,6 +27,6 @@ pub struct Unhandled { pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, } -impl ::dafny_runtime::UpcastObject for Unhandled { +impl UpcastObject for Unhandled { ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/implementation_from_dafny.rs-e b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/implementation_from_dafny.rs-e deleted file mode 100644 index 0c5711629..000000000 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/implementation_from_dafny.rs-e +++ /dev/null @@ -1,1880 +0,0 @@ -#![allow(warnings, unconditional_panic)] -#![allow(nonstandard_style)] - -pub mod _module { - -} -pub mod simple { - pub mod types { - pub mod smithystring { - pub mod internaldafny { - pub use ::dafny_runtime::UpcastObject; - pub use ::std::any::Any; - pub use crate::simple::types::smithystring::internaldafny::types::ISimpleTypesStringClient; - - pub struct _default {} - - impl _default { - pub fn DefaultSimpleStringConfig() -> ::std::rc::Rc { - ::std::rc::Rc::new(crate::simple::types::smithystring::internaldafny::types::SimpleStringConfig::SimpleStringConfig {}) - } - pub fn SimpleString(config: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut res = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - let mut client = ::dafny_runtime::MaybePlacebo::<::dafny_runtime::Object>::new(); - let mut _nw0: ::dafny_runtime::Object = crate::simple::types::smithystring::internaldafny::SimpleStringClient::_allocate_object(); - crate::simple::types::smithystring::internaldafny::SimpleStringClient::_ctor(&_nw0, &::std::rc::Rc::new(crate::r#_SimpleStringImpl_Compile::Config::Config {})); - client = ::dafny_runtime::MaybePlacebo::from(_nw0.clone()); - res = ::dafny_runtime::MaybePlacebo::from(::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::dafny_runtime::Object, ::std::rc::Rc>::Success { - value: client.read() - })); - return res.read(); - } - pub fn CreateSuccessOfClient(client: &::dafny_runtime::Object) -> ::std::rc::Rc, ::std::rc::Rc>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::dafny_runtime::Object, ::std::rc::Rc>::Success { - value: client.clone() - }) - } - pub fn CreateFailureOfError(error: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::dafny_runtime::Object, ::std::rc::Rc>::Failure { - error: error.clone() - }) - } - } - - pub struct SimpleStringClient { - pub r#__i_config: ::std::rc::Rc - } - - impl SimpleStringClient { - pub fn _allocate_object() -> ::dafny_runtime::Object { - ::dafny_runtime::allocate_object::() - } - pub fn _ctor(this: &::dafny_runtime::Object, config: &::std::rc::Rc) -> () { - let mut _set__i_config: bool = false; - ::dafny_runtime::update_field_uninit_object!(this.clone(), r#__i_config, _set__i_config, config.clone()); - return (); - } - pub fn config(&self) -> ::std::rc::Rc { - self.r#__i_config.clone() - } - } - - impl UpcastObject - for crate::simple::types::smithystring::internaldafny::SimpleStringClient { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); - } - - impl ISimpleTypesStringClient - for crate::simple::types::smithystring::internaldafny::SimpleStringClient { - fn GetString(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - let mut _out0 = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - _out0 = ::dafny_runtime::MaybePlacebo::from(crate::r#_SimpleStringImpl_Compile::_default::GetString(&self.config().clone(), input)); - output = ::dafny_runtime::MaybePlacebo::from(_out0.read()); - return output.read(); - } - fn GetStringKnownValue(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - let mut _out1 = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - _out1 = ::dafny_runtime::MaybePlacebo::from(crate::r#_SimpleStringImpl_Compile::_default::GetStringKnownValue(&self.config().clone(), input)); - output = ::dafny_runtime::MaybePlacebo::from(_out1.read()); - return output.read(); - } - fn GetStringUTF8(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - let mut _out2 = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - _out2 = ::dafny_runtime::MaybePlacebo::from(crate::r#_SimpleStringImpl_Compile::_default::GetStringUTF8(&self.config().clone(), input)); - output = ::dafny_runtime::MaybePlacebo::from(_out2.read()); - return output.read(); - } - fn GetStringUTF8KnownValue(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - let mut _out3 = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - _out3 = ::dafny_runtime::MaybePlacebo::from(crate::r#_SimpleStringImpl_Compile::_default::GetStringUTF8KnownValue(&self.config().clone(), input)); - output = ::dafny_runtime::MaybePlacebo::from(_out3.read()); - return output.read(); - } - } - - impl UpcastObject - for crate::simple::types::smithystring::internaldafny::SimpleStringClient { - ::dafny_runtime::UpcastObjectFn!(dyn crate::simple::types::smithystring::internaldafny::types::ISimpleTypesStringClient); - } - - pub mod types { - pub use ::std::fmt::Debug; - pub use ::dafny_runtime::DafnyPrint; - pub use ::std::cmp::Eq; - pub use ::std::hash::Hash; - pub use ::std::default::Default; - pub use ::std::convert::AsRef; - pub use ::dafny_runtime::UpcastObject; - pub use ::std::any::Any; - - #[derive(PartialEq, Clone)] - pub enum DafnyCallEvent { - DafnyCallEvent { - input: I, - output: O - } - } - - impl DafnyCallEvent { - pub fn input(&self) -> &I { - match self { - DafnyCallEvent::DafnyCallEvent{input, output, } => input, - } - } - pub fn output(&self) -> &O { - match self { - DafnyCallEvent::DafnyCallEvent{input, output, } => output, - } - } - } - - impl Debug - for DafnyCallEvent { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for DafnyCallEvent { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - DafnyCallEvent::DafnyCallEvent{input, output, } => { - write!(_formatter, "simple.types.smithystring.internaldafny.types.DafnyCallEvent.DafnyCallEvent(")?; - ::dafny_runtime::DafnyPrint::fmt_print(input, _formatter, false)?; - write!(_formatter, ", ")?; - ::dafny_runtime::DafnyPrint::fmt_print(output, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Eq - for DafnyCallEvent {} - - impl Hash - for DafnyCallEvent { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - DafnyCallEvent::DafnyCallEvent{input, output, } => { - ::std::hash::Hash::hash(input, _state); - ::std::hash::Hash::hash(output, _state) - }, - } - } - } - - impl Default - for DafnyCallEvent { - fn default() -> DafnyCallEvent { - DafnyCallEvent::DafnyCallEvent { - input: ::std::default::Default::default(), - output: ::std::default::Default::default() - } - } - } - - impl AsRef> - for &DafnyCallEvent { - fn as_ref(&self) -> Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum GetStringInput { - GetStringInput { - value: ::std::rc::Rc>> - } - } - - impl GetStringInput { - pub fn value(&self) -> &::std::rc::Rc>> { - match self { - GetStringInput::GetStringInput{value, } => value, - } - } - } - - impl Debug - for GetStringInput { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for GetStringInput { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - GetStringInput::GetStringInput{value, } => { - write!(_formatter, "simple.types.smithystring.internaldafny.types.GetStringInput.GetStringInput(")?; - ::dafny_runtime::DafnyPrint::fmt_print(value, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Eq - for GetStringInput {} - - impl Hash - for GetStringInput { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - GetStringInput::GetStringInput{value, } => { - ::std::hash::Hash::hash(value, _state) - }, - } - } - } - - impl Default - for GetStringInput { - fn default() -> GetStringInput { - GetStringInput::GetStringInput { - value: ::std::default::Default::default() - } - } - } - - impl AsRef - for &GetStringInput { - fn as_ref(&self) -> Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum GetStringOutput { - GetStringOutput { - value: ::std::rc::Rc>> - } - } - - impl GetStringOutput { - pub fn value(&self) -> &::std::rc::Rc>> { - match self { - GetStringOutput::GetStringOutput{value, } => value, - } - } - } - - impl Debug - for GetStringOutput { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for GetStringOutput { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - GetStringOutput::GetStringOutput{value, } => { - write!(_formatter, "simple.types.smithystring.internaldafny.types.GetStringOutput.GetStringOutput(")?; - ::dafny_runtime::DafnyPrint::fmt_print(value, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Eq - for GetStringOutput {} - - impl Hash - for GetStringOutput { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - GetStringOutput::GetStringOutput{value, } => { - ::std::hash::Hash::hash(value, _state) - }, - } - } - } - - impl Default - for GetStringOutput { - fn default() -> GetStringOutput { - GetStringOutput::GetStringOutput { - value: ::std::default::Default::default() - } - } - } - - impl AsRef - for &GetStringOutput { - fn as_ref(&self) -> Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum GetStringUTF8Input { - GetStringUTF8Input { - value: ::std::rc::Rc> - } - } - - impl GetStringUTF8Input { - pub fn value(&self) -> &::std::rc::Rc> { - match self { - GetStringUTF8Input::GetStringUTF8Input{value, } => value, - } - } - } - - impl Debug - for GetStringUTF8Input { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for GetStringUTF8Input { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - GetStringUTF8Input::GetStringUTF8Input{value, } => { - write!(_formatter, "simple.types.smithystring.internaldafny.types.GetStringUTF8Input.GetStringUTF8Input(")?; - ::dafny_runtime::DafnyPrint::fmt_print(value, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Eq - for GetStringUTF8Input {} - - impl Hash - for GetStringUTF8Input { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - GetStringUTF8Input::GetStringUTF8Input{value, } => { - ::std::hash::Hash::hash(value, _state) - }, - } - } - } - - impl Default - for GetStringUTF8Input { - fn default() -> GetStringUTF8Input { - GetStringUTF8Input::GetStringUTF8Input { - value: ::std::default::Default::default() - } - } - } - - impl AsRef - for &GetStringUTF8Input { - fn as_ref(&self) -> Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum GetStringUTF8Output { - GetStringUTF8Output { - value: ::std::rc::Rc> - } - } - - impl GetStringUTF8Output { - pub fn value(&self) -> &::std::rc::Rc> { - match self { - GetStringUTF8Output::GetStringUTF8Output{value, } => value, - } - } - } - - impl Debug - for GetStringUTF8Output { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for GetStringUTF8Output { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - GetStringUTF8Output::GetStringUTF8Output{value, } => { - write!(_formatter, "simple.types.smithystring.internaldafny.types.GetStringUTF8Output.GetStringUTF8Output(")?; - ::dafny_runtime::DafnyPrint::fmt_print(value, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Eq - for GetStringUTF8Output {} - - impl Hash - for GetStringUTF8Output { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - GetStringUTF8Output::GetStringUTF8Output{value, } => { - ::std::hash::Hash::hash(value, _state) - }, - } - } - } - - impl Default - for GetStringUTF8Output { - fn default() -> GetStringUTF8Output { - GetStringUTF8Output::GetStringUTF8Output { - value: ::std::default::Default::default() - } - } - } - - impl AsRef - for &GetStringUTF8Output { - fn as_ref(&self) -> Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum SimpleStringConfig { - SimpleStringConfig {} - } - - impl SimpleStringConfig {} - - impl Debug - for SimpleStringConfig { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for SimpleStringConfig { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - SimpleStringConfig::SimpleStringConfig{} => { - write!(_formatter, "simple.types.smithystring.internaldafny.types.SimpleStringConfig.SimpleStringConfig")?; - Ok(()) - }, - } - } - } - - impl SimpleStringConfig { - pub fn _AllSingletonConstructors() -> ::dafny_runtime::SequenceIter<::std::rc::Rc> { - ::dafny_runtime::seq![::std::rc::Rc::new(SimpleStringConfig::SimpleStringConfig {})].iter() - } - } - - impl Eq - for SimpleStringConfig {} - - impl Hash - for SimpleStringConfig { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - SimpleStringConfig::SimpleStringConfig{} => { - - }, - } - } - } - - impl Default - for SimpleStringConfig { - fn default() -> SimpleStringConfig { - SimpleStringConfig::SimpleStringConfig {} - } - } - - impl AsRef - for &SimpleStringConfig { - fn as_ref(&self) -> Self { - self - } - } - - pub struct ISimpleTypesStringClientCallHistory {} - - impl ISimpleTypesStringClientCallHistory { - pub fn _allocate_object() -> ::dafny_runtime::Object { - ::dafny_runtime::allocate_object::() - } - } - - impl UpcastObject - for crate::simple::types::smithystring::internaldafny::types::ISimpleTypesStringClientCallHistory { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); - } - - pub trait ISimpleTypesStringClient: ::std::any::Any + ::dafny_runtime::UpcastObject { - fn GetString(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>>; - fn GetStringKnownValue(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>>; - fn GetStringUTF8(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>>; - fn GetStringUTF8KnownValue(&mut self, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>>; - } - - #[derive(PartialEq, Clone)] - pub enum Error { - CollectionOfErrors { - list: ::dafny_runtime::Sequence<::std::rc::Rc>, - message: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> - }, - Opaque { - obj: ::dafny_runtime::Object - } - } - - impl Error { - pub fn list(&self) -> &::dafny_runtime::Sequence<::std::rc::Rc> { - match self { - Error::CollectionOfErrors{list, message, } => list, - Error::Opaque{obj, } => panic!("field does not exist on this variant"), - } - } - pub fn message(&self) -> &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - match self { - Error::CollectionOfErrors{list, message, } => message, - Error::Opaque{obj, } => panic!("field does not exist on this variant"), - } - } - pub fn obj(&self) -> &::dafny_runtime::Object { - match self { - Error::CollectionOfErrors{list, message, } => panic!("field does not exist on this variant"), - Error::Opaque{obj, } => obj, - } - } - } - - impl Debug - for Error { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Error { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Error::CollectionOfErrors{list, message, } => { - write!(_formatter, "simple.types.smithystring.internaldafny.types.Error.CollectionOfErrors(")?; - ::dafny_runtime::DafnyPrint::fmt_print(list, _formatter, false)?; - write!(_formatter, ", ")?; - ::dafny_runtime::DafnyPrint::fmt_print(message, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - Error::Opaque{obj, } => { - write!(_formatter, "simple.types.smithystring.internaldafny.types.Error.Opaque(")?; - ::dafny_runtime::DafnyPrint::fmt_print(obj, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Eq - for Error {} - - impl Hash - for Error { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - Error::CollectionOfErrors{list, message, } => { - ::std::hash::Hash::hash(list, _state); - ::std::hash::Hash::hash(message, _state) - }, - Error::Opaque{obj, } => { - ::std::hash::Hash::hash(obj, _state) - }, - } - } - } - - impl Default - for Error { - fn default() -> Error { - Error::CollectionOfErrors { - list: ::std::default::Default::default(), - message: ::std::default::Default::default() - } - } - } - - impl AsRef - for &Error { - fn as_ref(&self) -> Self { - self - } - } - - pub type OpaqueError = ::std::rc::Rc; - } - } - } - } -} -pub mod r#_SimpleStringImpl_Compile { - pub use ::std::fmt::Debug; - pub use ::dafny_runtime::DafnyPrint; - pub use ::std::cmp::Eq; - pub use ::std::hash::Hash; - pub use ::std::default::Default; - pub use ::std::convert::AsRef; - - pub struct _default {} - - impl _default { - pub fn GetString(config: &::std::rc::Rc, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - let mut res: ::std::rc::Rc = ::std::rc::Rc::new(crate::simple::types::smithystring::internaldafny::types::GetStringOutput::GetStringOutput { - value: input.value().clone() - }); - output = ::dafny_runtime::MaybePlacebo::from(::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::std::rc::Rc, ::std::rc::Rc>::Success { - value: res.clone() - })); - return output.read(); - } - pub fn GetStringKnownValue(config: &::std::rc::Rc, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - if !matches!(input.value().as_ref(), crate::r#_Wrappers_Compile::Option::Some{ .. }) { - panic!("Halt") - }; - let mut _e00: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> = input.value().value().clone(); - let mut _e10: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> = ::dafny_runtime::string_utf16_of("TEST_SIMPLE_STRING_KNOWN_VALUE"); - if !(_e00.clone() == _e10.clone()) { - print!("{}", ::dafny_runtime::DafnyPrintWrapper(&::dafny_runtime::string_utf16_of("Left:\n"))); - print!("{}", ::dafny_runtime::DafnyPrintWrapper(&_e00)); - print!("{}", ::dafny_runtime::DafnyPrintWrapper(&::dafny_runtime::string_utf16_of("Right:\n"))); - print!("{}", ::dafny_runtime::DafnyPrintWrapper(&_e10)); - panic!("Halt") - }; - let mut res: ::std::rc::Rc = ::std::rc::Rc::new(crate::simple::types::smithystring::internaldafny::types::GetStringOutput::GetStringOutput { - value: input.value().clone() - }); - output = ::dafny_runtime::MaybePlacebo::from(::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::std::rc::Rc, ::std::rc::Rc>::Success { - value: res.clone() - })); - return output.read(); - } - pub fn GetStringUTF8(config: &::std::rc::Rc, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - if !matches!(input.value().as_ref(), crate::r#_Wrappers_Compile::Option::Some{ .. }) { - panic!("Halt") - }; - let mut res: ::std::rc::Rc = ::std::rc::Rc::new(crate::simple::types::smithystring::internaldafny::types::GetStringUTF8Output::GetStringUTF8Output { - value: input.value().clone() - }); - output = ::dafny_runtime::MaybePlacebo::from(::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::std::rc::Rc, ::std::rc::Rc>::Success { - value: res.clone() - })); - return output.read(); - } - pub fn GetStringUTF8KnownValue(config: &::std::rc::Rc, input: &::std::rc::Rc) -> ::std::rc::Rc, ::std::rc::Rc>> { - let mut output = ::dafny_runtime::MaybePlacebo::<::std::rc::Rc, ::std::rc::Rc>>>::new(); - if !matches!(input.value().as_ref(), crate::r#_Wrappers_Compile::Option::Some{ .. }) { - panic!("Halt") - }; - let mut expected: ::dafny_runtime::Sequence = ::dafny_runtime::seq![72, 101, 108, 108, 111]; - let mut _e01: crate::UTF8::ValidUTF8Bytes = input.value().value().clone(); - let mut _e11: ::dafny_runtime::Sequence = expected.clone(); - if !(_e01.clone() == _e11.clone()) { - print!("{}", ::dafny_runtime::DafnyPrintWrapper(&::dafny_runtime::string_utf16_of("Left:\n"))); - print!("{}", ::dafny_runtime::DafnyPrintWrapper(&_e01)); - print!("{}", ::dafny_runtime::DafnyPrintWrapper(&::dafny_runtime::string_utf16_of("Right:\n"))); - print!("{}", ::dafny_runtime::DafnyPrintWrapper(&_e11)); - panic!("Halt") - }; - let mut res: ::std::rc::Rc = ::std::rc::Rc::new(crate::simple::types::smithystring::internaldafny::types::GetStringUTF8Output::GetStringUTF8Output { - value: input.value().clone() - }); - output = ::dafny_runtime::MaybePlacebo::from(::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::std::rc::Rc, ::std::rc::Rc>::Success { - value: res.clone() - })); - return output.read(); - } - } - - #[derive(PartialEq, Clone)] - pub enum Config { - Config {} - } - - impl Config {} - - impl Debug - for Config { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Config { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Config::Config{} => { - write!(_formatter, "SimpleStringImpl_Compile.Config.Config")?; - Ok(()) - }, - } - } - } - - impl Config { - pub fn _AllSingletonConstructors() -> ::dafny_runtime::SequenceIter<::std::rc::Rc> { - ::dafny_runtime::seq![::std::rc::Rc::new(Config::Config {})].iter() - } - } - - impl Eq - for Config {} - - impl Hash - for Config { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - Config::Config{} => { - - }, - } - } - } - - impl Default - for Config { - fn default() -> Config { - Config::Config {} - } - } - - impl AsRef - for &Config { - fn as_ref(&self) -> Self { - self - } - } -} -pub mod r#_StandardLibrary_Compile { - pub struct _default {} - - impl _default { - pub fn Join<_T: ::dafny_runtime::DafnyType>(ss: &::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>>, joiner: &::dafny_runtime::Sequence<_T>) -> ::dafny_runtime::Sequence<_T> { - let mut _accumulator: ::dafny_runtime::Sequence<_T> = ::dafny_runtime::seq![] as ::dafny_runtime::Sequence<_T>; - let mut _r0 = ss.clone(); - let mut _r1 = joiner.clone(); - 'TAIL_CALL_START: loop { - let ss = _r0; - let joiner = _r1; - if ss.cardinality() == ::dafny_runtime::int!(1) { - return _accumulator.concat(&ss.get(&::dafny_runtime::int!(0))); - } else { - _accumulator = _accumulator.concat(&ss.get(&::dafny_runtime::int!(0)).concat(&joiner)); - let mut _in0: ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>> = ss.drop(&::dafny_runtime::int!(1)); - let mut _in1: ::dafny_runtime::Sequence<_T> = joiner.clone(); - _r0 = _in0.clone(); - _r1 = _in1.clone(); - continue 'TAIL_CALL_START; - } - } - } - pub fn Split<_T: ::dafny_runtime::DafnyTypeEq>(s: &::dafny_runtime::Sequence<_T>, delim: &_T) -> ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>> { - let mut _accumulator: ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>> = ::dafny_runtime::seq![] as ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>>; - let mut _r0 = s.clone(); - let mut _r1 = delim.clone(); - 'TAIL_CALL_START: loop { - let s = _r0; - let delim = _r1; - let mut i: ::std::rc::Rc> = crate::r#_StandardLibrary_Compile::_default::FindIndexMatching::<_T>(&s, &delim, &::dafny_runtime::int!(0)); - if matches!((&i).as_ref(), crate::r#_Wrappers_Compile::Option::Some{ .. }) { - _accumulator = _accumulator.concat(&::dafny_runtime::seq![s.take(i.value())]); - let mut _in2: ::dafny_runtime::Sequence<_T> = s.drop(&(i.value().clone() + ::dafny_runtime::int!(1))); - let mut _in3: _T = delim.clone(); - _r0 = _in2.clone(); - _r1 = _in3.clone(); - continue 'TAIL_CALL_START; - } else { - return _accumulator.concat(&::dafny_runtime::seq![s.clone()]); - } - } - } - pub fn SplitOnce<_T: ::dafny_runtime::DafnyTypeEq>(s: &::dafny_runtime::Sequence<_T>, delim: &_T) -> (::dafny_runtime::Sequence<_T>, ::dafny_runtime::Sequence<_T>) { - let mut i: ::std::rc::Rc> = crate::r#_StandardLibrary_Compile::_default::FindIndexMatching::<_T>(s, delim, &::dafny_runtime::int!(0)); - ( - s.take(i.value()), - s.drop(&(i.value().clone() + ::dafny_runtime::int!(1))) - ) - } - pub fn r#_SplitOnce_q<_T: ::dafny_runtime::DafnyTypeEq>(s: &::dafny_runtime::Sequence<_T>, delim: &_T) -> ::std::rc::Rc, ::dafny_runtime::Sequence<_T>)>> { - let mut valueOrError0: ::std::rc::Rc> = crate::r#_StandardLibrary_Compile::_default::FindIndexMatching::<_T>(s, delim, &::dafny_runtime::int!(0)); - if valueOrError0.IsFailure() { - valueOrError0.PropagateFailure::<(::dafny_runtime::Sequence<_T>, ::dafny_runtime::Sequence<_T>)>() - } else { - let mut i: ::dafny_runtime::_System::nat = valueOrError0.Extract(); - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::<(::dafny_runtime::Sequence<_T>, ::dafny_runtime::Sequence<_T>)>::Some { - value: ( - s.take(&i), - s.drop(&(i.clone() + ::dafny_runtime::int!(1))) - ) - }) - } - } - pub fn FindIndexMatching<_T: ::dafny_runtime::DafnyTypeEq>(s: &::dafny_runtime::Sequence<_T>, c: &_T, i: &::dafny_runtime::_System::nat) -> ::std::rc::Rc> { - crate::r#_StandardLibrary_Compile::_default::FindIndex::<_T>(s, { - let c: _T = c.clone(); - &({ - let mut c = c.clone(); - ::std::rc::Rc::new(move |x: &_T| -> bool{ - x.clone() == c.clone() - }) - }) - }, i) - } - pub fn FindIndex<_T: ::dafny_runtime::DafnyType>(s: &::dafny_runtime::Sequence<_T>, f: &::std::rc::Rc bool>, i: &::dafny_runtime::_System::nat) -> ::std::rc::Rc> { - let mut _r0 = s.clone(); - let mut _r1 = f.clone(); - let mut _r2 = i.clone(); - 'TAIL_CALL_START: loop { - let s = _r0; - let f = _r1; - let i = _r2; - if i.clone() == s.cardinality() { - return ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::<::dafny_runtime::_System::nat>::None {}); - } else { - if (&f)(&s.get(&i)) { - return ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::<::dafny_runtime::_System::nat>::Some { - value: i.clone() - }); - } else { - let mut _in4: ::dafny_runtime::Sequence<_T> = s.clone(); - let mut _in5: ::std::rc::Rc bool> = f.clone(); - let mut _in6: ::dafny_runtime::DafnyInt = i.clone() + ::dafny_runtime::int!(1); - _r0 = _in4.clone(); - _r1 = _in5.clone(); - _r2 = _in6.clone(); - continue 'TAIL_CALL_START; - } - } - } - } - pub fn Filter<_T: ::dafny_runtime::DafnyType>(s: &::dafny_runtime::Sequence<_T>, f: &::std::rc::Rc bool>) -> ::dafny_runtime::Sequence<_T> { - let mut _accumulator: ::dafny_runtime::Sequence<_T> = ::dafny_runtime::seq![] as ::dafny_runtime::Sequence<_T>; - let mut _r0 = s.clone(); - let mut _r1 = f.clone(); - 'TAIL_CALL_START: loop { - let s = _r0; - let f = _r1; - if s.cardinality() == ::dafny_runtime::int!(0) { - return _accumulator.concat(&(::dafny_runtime::seq![] as ::dafny_runtime::Sequence<_T>)); - } else { - if (&f)(&s.get(&::dafny_runtime::int!(0))) { - _accumulator = _accumulator.concat(&::dafny_runtime::seq![s.get(&::dafny_runtime::int!(0))]); - let mut _in7: ::dafny_runtime::Sequence<_T> = s.drop(&::dafny_runtime::int!(1)); - let mut _in8: ::std::rc::Rc bool> = f.clone(); - _r0 = _in7.clone(); - _r1 = _in8.clone(); - continue 'TAIL_CALL_START; - } else { - let mut _in9: ::dafny_runtime::Sequence<_T> = s.drop(&::dafny_runtime::int!(1)); - let mut _in10: ::std::rc::Rc bool> = f.clone(); - _r0 = _in9.clone(); - _r1 = _in10.clone(); - continue 'TAIL_CALL_START; - } - } - } - } - pub fn Min(a: &::dafny_runtime::DafnyInt, b: &::dafny_runtime::DafnyInt) -> ::dafny_runtime::DafnyInt { - if a.clone() < b.clone() { - a.clone() - } else { - b.clone() - } - } - pub fn Fill<_T: ::dafny_runtime::DafnyType>(value: &_T, n: &::dafny_runtime::_System::nat) -> ::dafny_runtime::Sequence<_T> { - { - let _initializer = { - let value: _T = value.clone(); - { - let mut value = value.clone(); - ::std::rc::Rc::new(move |_v0: &::dafny_runtime::DafnyInt| -> _T{ - value.clone() - }) - } - }; - ::dafny_runtime::integer_range(::dafny_runtime::Zero::zero(), n.clone()).map(|i| _initializer(&i)).collect::<::dafny_runtime::Sequence<_>>() - } - } - pub fn SeqToArray<_T: ::dafny_runtime::DafnyType>(s: &::dafny_runtime::Sequence<_T>) -> ::dafny_runtime::Object<[_T]> { - let mut a = ::dafny_runtime::MaybePlacebo::<::dafny_runtime::Object<[_T]>>::new(); - let mut _init0: ::std::rc::Rc _T> = { - let s: ::dafny_runtime::Sequence<_T> = s.clone(); - { - let mut s = s.clone(); - ::std::rc::Rc::new(move |i: &::dafny_runtime::DafnyInt| -> _T{ - s.get(i) - }) - } - }; - let mut _nw1: ::dafny_runtime::Object<[::std::mem::MaybeUninit<_T>]> = ::dafny_runtime::array::placebos_usize_object::<_T>(::dafny_runtime::DafnyUsize::into_usize(s.cardinality())); - for r#__i0_0 in ::dafny_runtime::integer_range(0, ::dafny_runtime::rd!(_nw1.clone()).len()) { - { - let __idx0 = ::dafny_runtime::DafnyUsize::into_usize(r#__i0_0.clone()); - ::dafny_runtime::md!(_nw1)[__idx0] = ::std::mem::MaybeUninit::new((&_init0)(&::dafny_runtime::int!(r#__i0_0.clone()))); - } - } - a = ::dafny_runtime::MaybePlacebo::from(::dafny_runtime::array::construct_object(_nw1.clone())); - return a.read(); - } - pub fn LexicographicLessOrEqual<_T: ::dafny_runtime::DafnyTypeEq>(a: &::dafny_runtime::Sequence<_T>, b: &::dafny_runtime::Sequence<_T>, less: &::std::rc::Rc bool>) -> bool { - ::dafny_runtime::integer_range(::dafny_runtime::int!(0), a.cardinality() + ::dafny_runtime::int!(1)).any(({ - let mut a = a.clone(); - let mut b = b.clone(); - let mut less = less.clone(); - ::std::rc::Rc::new(move |r#__exists_var_0: ::dafny_runtime::DafnyInt| -> bool{ - let mut k: ::dafny_runtime::DafnyInt = r#__exists_var_0.clone(); - ::dafny_runtime::int!(0) <= k.clone() && k.clone() <= a.cardinality() && crate::r#_StandardLibrary_Compile::_default::LexicographicLessOrEqualAux::<_T>(&a, &b, &less, &k) - }) - }).as_ref()) - } - pub fn LexicographicLessOrEqualAux<_T: ::dafny_runtime::DafnyTypeEq>(a: &::dafny_runtime::Sequence<_T>, b: &::dafny_runtime::Sequence<_T>, less: &::std::rc::Rc bool>, lengthOfCommonPrefix: &::dafny_runtime::_System::nat) -> bool { - lengthOfCommonPrefix.clone() <= b.cardinality() && ::dafny_runtime::integer_range(::dafny_runtime::int!(0), lengthOfCommonPrefix.clone()).all(({ - let mut lengthOfCommonPrefix = lengthOfCommonPrefix.clone(); - let mut a = a.clone(); - let mut b = b.clone(); - ::std::rc::Rc::new(move |r#__forall_var_0: ::dafny_runtime::DafnyInt| -> bool{ - let mut i: ::dafny_runtime::DafnyInt = r#__forall_var_0.clone(); - !(::dafny_runtime::int!(0) <= i.clone() && i.clone() < lengthOfCommonPrefix.clone()) || a.get(&i) == b.get(&i) - }) - }).as_ref()) && (lengthOfCommonPrefix.clone() == a.cardinality() || lengthOfCommonPrefix.clone() < b.cardinality() && less(&a.get(lengthOfCommonPrefix), &b.get(lengthOfCommonPrefix))) - } - pub fn SetToOrderedSequence<_T: ::dafny_runtime::DafnyTypeEq>(s: &::dafny_runtime::Set<::dafny_runtime::Sequence<_T>>, less: &::std::rc::Rc bool>) -> ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>> { - let mut _accumulator: ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>> = ::dafny_runtime::seq![] as ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>>; - let mut _r0 = s.clone(); - let mut _r1 = less.clone(); - 'TAIL_CALL_START: loop { - let s = _r0; - let less = _r1; - if s.clone() == ::dafny_runtime::set!{} { - return _accumulator.concat(&(::dafny_runtime::seq![] as ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>>)); - } else { - return (&({ - let mut s = s.clone(); - let mut less = less.clone(); - ::std::rc::Rc::new(move |r#__let_dummy_0: &::dafny_runtime::DafnyInt| -> ::dafny_runtime::Sequence<::dafny_runtime::Sequence<_T>>{ - let mut a = ::dafny_runtime::MaybePlacebo::<::dafny_runtime::Sequence<_T>>::new(); - 'label_goto__ASSIGN_SUCH_THAT_0: loop { - for r#__assign_such_that_0 in (&s).iter().cloned() { - a = ::dafny_runtime::MaybePlacebo::from(r#__assign_such_that_0.clone()); - if s.contains(&a.read()) && crate::r#_StandardLibrary_Compile::_default::IsMinimum::<_T>(&a.read(), &s, &less) { - break 'label_goto__ASSIGN_SUCH_THAT_0; - } - } - panic!("Halt"); - break; - }; - ::dafny_runtime::seq![a.read()].concat(&crate::r#_StandardLibrary_Compile::_default::SetToOrderedSequence::<_T>(&s.subtract(&::dafny_runtime::set!{a.read()}), &less)) - }) - }))(&::dafny_runtime::int!(0)); - } - } - } - pub fn IsMinimum<_T: ::dafny_runtime::DafnyTypeEq>(a: &::dafny_runtime::Sequence<_T>, s: &::dafny_runtime::Set<::dafny_runtime::Sequence<_T>>, less: &::std::rc::Rc bool>) -> bool { - s.contains(a) && s.iter().all(({ - let mut a = a.clone(); - let mut s = s.clone(); - let mut less = less.clone(); - ::std::rc::Rc::new(move |r#__forall_var_1: &::dafny_runtime::Sequence<_T>| -> bool{ - let mut z: ::dafny_runtime::Sequence<_T> = r#__forall_var_1.clone(); - !s.contains(&z) || crate::r#_StandardLibrary_Compile::_default::LexicographicLessOrEqual::<_T>(&a, &z, &less) - }) - }).as_ref()) - } - } - - pub mod r#_UInt_Compile { - pub use ::std::default::Default; - pub use ::dafny_runtime::DafnyPrint; - - pub struct _default {} - - impl _default { - pub fn UInt8Less(a: u8, b: u8) -> bool { - a < b - } - pub fn HasUint16Len<_T: ::dafny_runtime::DafnyType>(s: &::dafny_runtime::Sequence<_T>) -> bool { - s.cardinality() < crate::r#_StandardLibrary_Compile::r#_UInt_Compile::_default::UINT16_LIMIT() - } - pub fn HasUint32Len<_T: ::dafny_runtime::DafnyType>(s: &::dafny_runtime::Sequence<_T>) -> bool { - s.cardinality() < crate::r#_StandardLibrary_Compile::r#_UInt_Compile::_default::UINT32_LIMIT() - } - pub fn HasUint64Len<_T: ::dafny_runtime::DafnyType>(s: &::dafny_runtime::Sequence<_T>) -> bool { - s.cardinality() < crate::r#_StandardLibrary_Compile::r#_UInt_Compile::_default::UINT64_LIMIT() - } - pub fn UInt16ToSeq(x: u16) -> ::dafny_runtime::Sequence { - let mut b0: u8 = (x / 256) as u8; - let mut b1: u8 = (x % 256) as u8; - ::dafny_runtime::seq![b0, b1] - } - pub fn SeqToUInt16(s: &::dafny_runtime::Sequence) -> u16 { - let mut x0: u16 = s.get(&::dafny_runtime::int!(0)) as u16 * 256; - x0 + s.get(&::dafny_runtime::int!(1)) as u16 - } - pub fn UInt32ToSeq(x: u32) -> ::dafny_runtime::Sequence { - let mut b0: u8 = (x / 16777216) as u8; - let mut x0: u32 = x - b0 as u32 * 16777216; - let mut b1: u8 = (x0 / 65536) as u8; - let mut x1: u32 = x0 - b1 as u32 * 65536; - let mut b2: u8 = (x1 / 256) as u8; - let mut b3: u8 = (x1 % 256) as u8; - ::dafny_runtime::seq![b0, b1, b2, b3] - } - pub fn SeqToUInt32(s: &::dafny_runtime::Sequence) -> u32 { - let mut x0: u32 = s.get(&::dafny_runtime::int!(0)) as u32 * 16777216; - let mut x1: u32 = x0 + s.get(&::dafny_runtime::int!(1)) as u32 * 65536; - let mut x2: u32 = x1 + s.get(&::dafny_runtime::int!(2)) as u32 * 256; - x2 + s.get(&::dafny_runtime::int!(3)) as u32 - } - pub fn UInt64ToSeq(x: u64) -> ::dafny_runtime::Sequence { - let mut b0: u8 = (x / 72057594037927936) as u8; - let mut x0: u64 = x - b0 as u64 * 72057594037927936; - let mut b1: u8 = (x0 / 281474976710656) as u8; - let mut x1: u64 = x0 - b1 as u64 * 281474976710656; - let mut b2: u8 = (x1 / 1099511627776) as u8; - let mut x2: u64 = x1 - b2 as u64 * 1099511627776; - let mut b3: u8 = (x2 / 4294967296) as u8; - let mut x3: u64 = x2 - b3 as u64 * 4294967296; - let mut b4: u8 = (x3 / 16777216) as u8; - let mut x4: u64 = x3 - b4 as u64 * 16777216; - let mut b5: u8 = (x4 / 65536) as u8; - let mut x5: u64 = x4 - b5 as u64 * 65536; - let mut b6: u8 = (x5 / 256) as u8; - let mut b7: u8 = (x5 % 256) as u8; - ::dafny_runtime::seq![b0, b1, b2, b3, b4, b5, b6, b7] - } - pub fn SeqToUInt64(s: &::dafny_runtime::Sequence) -> u64 { - let mut x0: u64 = s.get(&::dafny_runtime::int!(0)) as u64 * 72057594037927936; - let mut x1: u64 = x0 + s.get(&::dafny_runtime::int!(1)) as u64 * 281474976710656; - let mut x2: u64 = x1 + s.get(&::dafny_runtime::int!(2)) as u64 * 1099511627776; - let mut x3: u64 = x2 + s.get(&::dafny_runtime::int!(3)) as u64 * 4294967296; - let mut x4: u64 = x3 + s.get(&::dafny_runtime::int!(4)) as u64 * 16777216; - let mut x5: u64 = x4 + s.get(&::dafny_runtime::int!(5)) as u64 * 65536; - let mut x6: u64 = x5 + s.get(&::dafny_runtime::int!(6)) as u64 * 256; - let mut x: u64 = x6 + s.get(&::dafny_runtime::int!(7)) as u64; - x - } - pub fn UINT16_LIMIT() -> ::dafny_runtime::DafnyInt { - ::dafny_runtime::int!(b"65536") - } - pub fn UINT32_LIMIT() -> ::dafny_runtime::DafnyInt { - ::dafny_runtime::int!(b"4294967296") - } - pub fn UINT64_LIMIT() -> ::dafny_runtime::DafnyInt { - ::dafny_runtime::int!(b"18446744073709551616") - } - pub fn INT32_MAX_LIMIT() -> ::dafny_runtime::DafnyInt { - ::dafny_runtime::int!(b"2147483648") - } - pub fn INT64_MAX_LIMIT() -> ::dafny_runtime::DafnyInt { - ::dafny_runtime::int!(b"9223372036854775808") - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct uint8(pub u8); - - impl uint8 { - pub fn is(_source: u8) -> bool { - return true; - } - } - - impl Default - for uint8 { - fn default() -> Self { - uint8(::std::default::Default::default()) - } - } - - impl DafnyPrint - for uint8 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for uint8 { - type Target = u8; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct uint16(pub u16); - - impl uint16 { - pub fn is(_source: u16) -> bool { - return true; - } - } - - impl Default - for uint16 { - fn default() -> Self { - uint16(::std::default::Default::default()) - } - } - - impl DafnyPrint - for uint16 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for uint16 { - type Target = u16; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct uint32(pub u32); - - impl uint32 { - pub fn is(_source: u32) -> bool { - return true; - } - } - - impl Default - for uint32 { - fn default() -> Self { - uint32(::std::default::Default::default()) - } - } - - impl DafnyPrint - for uint32 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for uint32 { - type Target = u32; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct uint64(pub u64); - - impl uint64 { - pub fn is(_source: u64) -> bool { - return true; - } - } - - impl Default - for uint64 { - fn default() -> Self { - uint64(::std::default::Default::default()) - } - } - - impl DafnyPrint - for uint64 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for uint64 { - type Target = u64; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct int32(pub i32); - - impl int32 { - pub fn is(_source: i32) -> bool { - return true; - } - } - - impl Default - for int32 { - fn default() -> Self { - int32(::std::default::Default::default()) - } - } - - impl DafnyPrint - for int32 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for int32 { - type Target = i32; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct int64(pub i64); - - impl int64 { - pub fn is(_source: i64) -> bool { - return true; - } - } - - impl Default - for int64 { - fn default() -> Self { - int64(::std::default::Default::default()) - } - } - - impl DafnyPrint - for int64 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for int64 { - type Target = i64; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - #[derive(Clone, PartialEq)] - #[repr(transparent)] - pub struct posInt64(pub u64); - - impl posInt64 { - pub fn is(_source: u64) -> bool { - let mut x: ::dafny_runtime::DafnyInt = ::std::convert::Into::<::dafny_runtime::DafnyInt>::into(_source.clone()); - return ::dafny_runtime::int!(0) < x.clone() && x.clone() < ::dafny_runtime::int!(b"9223372036854775808"); - } - } - - impl Default - for posInt64 { - fn default() -> Self { - posInt64(1) - } - } - - impl DafnyPrint - for posInt64 { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, in_seq: bool) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq) - } - } - - impl ::std::ops::Deref - for posInt64 { - type Target = u64; - fn deref(&self) -> &Self::Target { - &self.0 - } - } - - pub type seq16 = ::dafny_runtime::Sequence; - - pub type seq32 = ::dafny_runtime::Sequence; - - pub type seq64 = ::dafny_runtime::Sequence; - } -} -pub mod r#_StandardLibraryInterop_Compile { - pub use ::dafny_runtime::UpcastObject; - pub use ::std::any::Any; - - pub struct WrappersInterop {} - - impl WrappersInterop { - pub fn _allocate_object() -> ::dafny_runtime::Object { - ::dafny_runtime::allocate_object::() - } - pub fn CreateStringSome(s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> ::std::rc::Rc>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Some { - value: s.clone() - }) - } - pub fn CreateStringNone() -> ::std::rc::Rc>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::None {}) - } - pub fn CreateBooleanSome(b: bool) -> ::std::rc::Rc> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::::Some { - value: b - }) - } - pub fn CreateBooleanNone() -> ::std::rc::Rc> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::::None {}) - } - } - - impl UpcastObject - for WrappersInterop { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); - } -} -pub mod UTF8 { - pub struct _default {} - - impl _default { - pub fn CreateEncodeSuccess(bytes: &crate::UTF8::ValidUTF8Bytes) -> ::std::rc::Rc>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::>::Success { - value: bytes.clone() - }) - } - pub fn CreateEncodeFailure(error: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> ::std::rc::Rc>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::>::Failure { - error: error.clone() - }) - } - pub fn CreateDecodeSuccess(s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> ::std::rc::Rc, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { - value: s.clone() - }) - } - pub fn CreateDecodeFailure(error: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> ::std::rc::Rc, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { - error: error.clone() - }) - } - pub fn IsASCIIString(s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> bool { - let mut _hresult: bool = ::default(); - let mut _hi0: ::dafny_runtime::DafnyInt = s.cardinality(); - for i in ::dafny_runtime::integer_range(::dafny_runtime::int!(0), _hi0.clone()) { - if !(::dafny_runtime::int!(s.get(&i).0) < ::dafny_runtime::int!(128)) { - _hresult = false; - return _hresult; - } - } - _hresult = true; - return _hresult; - } - pub fn EncodeAscii(s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> crate::UTF8::ValidUTF8Bytes { - let mut _accumulator: crate::UTF8::ValidUTF8Bytes = ::dafny_runtime::seq![] as ::dafny_runtime::Sequence; - let mut _r0 = s.clone(); - 'TAIL_CALL_START: loop { - let s = _r0; - if s.cardinality() == ::dafny_runtime::int!(0) { - return _accumulator.concat(&(::dafny_runtime::seq![] as ::dafny_runtime::Sequence)); - } else { - let mut x: ::dafny_runtime::Sequence = ::dafny_runtime::seq![s.get(&::dafny_runtime::int!(0)).0 as u8]; - _accumulator = _accumulator.concat(&x); - let mut _in11: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> = s.drop(&::dafny_runtime::int!(1)); - _r0 = _in11.clone(); - continue 'TAIL_CALL_START; - } - } - } - pub fn Uses1Byte(s: &::dafny_runtime::Sequence) -> bool { - 0 <= s.get(&::dafny_runtime::int!(0)) && s.get(&::dafny_runtime::int!(0)) <= 127 - } - pub fn Uses2Bytes(s: &::dafny_runtime::Sequence) -> bool { - 194 <= s.get(&::dafny_runtime::int!(0)) && s.get(&::dafny_runtime::int!(0)) <= 223 && (128 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 191) - } - pub fn Uses3Bytes(s: &::dafny_runtime::Sequence) -> bool { - s.get(&::dafny_runtime::int!(0)) == 224 && (160 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) || 225 <= s.get(&::dafny_runtime::int!(0)) && s.get(&::dafny_runtime::int!(0)) <= 236 && (128 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) || s.get(&::dafny_runtime::int!(0)) == 237 && (128 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 159) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) || 238 <= s.get(&::dafny_runtime::int!(0)) && s.get(&::dafny_runtime::int!(0)) <= 239 && (128 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) - } - pub fn Uses4Bytes(s: &::dafny_runtime::Sequence) -> bool { - s.get(&::dafny_runtime::int!(0)) == 240 && (144 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(3)) && s.get(&::dafny_runtime::int!(3)) <= 191) || 241 <= s.get(&::dafny_runtime::int!(0)) && s.get(&::dafny_runtime::int!(0)) <= 243 && (128 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(3)) && s.get(&::dafny_runtime::int!(3)) <= 191) || s.get(&::dafny_runtime::int!(0)) == 244 && (128 <= s.get(&::dafny_runtime::int!(1)) && s.get(&::dafny_runtime::int!(1)) <= 143) && (128 <= s.get(&::dafny_runtime::int!(2)) && s.get(&::dafny_runtime::int!(2)) <= 191) && (128 <= s.get(&::dafny_runtime::int!(3)) && s.get(&::dafny_runtime::int!(3)) <= 191) - } - pub fn ValidUTF8Range(a: &::dafny_runtime::Sequence, lo: &::dafny_runtime::_System::nat, hi: &::dafny_runtime::_System::nat) -> bool { - let mut _r0 = a.clone(); - let mut _r1 = lo.clone(); - let mut _r2 = hi.clone(); - 'TAIL_CALL_START: loop { - let a = _r0; - let lo = _r1; - let hi = _r2; - if lo.clone() == hi.clone() { - return true; - } else { - let mut r: ::dafny_runtime::Sequence = a.slice(&lo, &hi); - if crate::UTF8::_default::Uses1Byte(&r) { - let mut _in12: ::dafny_runtime::Sequence = a.clone(); - let mut _in13: ::dafny_runtime::DafnyInt = lo.clone() + ::dafny_runtime::int!(1); - let mut _in14: ::dafny_runtime::_System::nat = hi.clone(); - _r0 = _in12.clone(); - _r1 = _in13.clone(); - _r2 = _in14.clone(); - continue 'TAIL_CALL_START; - } else { - if ::dafny_runtime::int!(2) <= r.cardinality() && crate::UTF8::_default::Uses2Bytes(&r) { - let mut _in15: ::dafny_runtime::Sequence = a.clone(); - let mut _in16: ::dafny_runtime::DafnyInt = lo.clone() + ::dafny_runtime::int!(2); - let mut _in17: ::dafny_runtime::_System::nat = hi.clone(); - _r0 = _in15.clone(); - _r1 = _in16.clone(); - _r2 = _in17.clone(); - continue 'TAIL_CALL_START; - } else { - if ::dafny_runtime::int!(3) <= r.cardinality() && crate::UTF8::_default::Uses3Bytes(&r) { - let mut _in18: ::dafny_runtime::Sequence = a.clone(); - let mut _in19: ::dafny_runtime::DafnyInt = lo.clone() + ::dafny_runtime::int!(3); - let mut _in20: ::dafny_runtime::_System::nat = hi.clone(); - _r0 = _in18.clone(); - _r1 = _in19.clone(); - _r2 = _in20.clone(); - continue 'TAIL_CALL_START; - } else { - if ::dafny_runtime::int!(4) <= r.cardinality() && crate::UTF8::_default::Uses4Bytes(&r) { - let mut _in21: ::dafny_runtime::Sequence = a.clone(); - let mut _in22: ::dafny_runtime::DafnyInt = lo.clone() + ::dafny_runtime::int!(4); - let mut _in23: ::dafny_runtime::_System::nat = hi.clone(); - _r0 = _in21.clone(); - _r1 = _in22.clone(); - _r2 = _in23.clone(); - continue 'TAIL_CALL_START; - } else { - return false; - } - } - } - } - } - } - } - pub fn ValidUTF8Seq(s: &::dafny_runtime::Sequence) -> bool { - crate::UTF8::_default::ValidUTF8Range(s, &::dafny_runtime::int!(0), &s.cardinality()) - } - } - - pub type ValidUTF8Bytes = ::dafny_runtime::Sequence; - - pub fn r#__init_ValidUTF8Bytes() -> ::dafny_runtime::Sequence { - ::dafny_runtime::seq![] as ::dafny_runtime::Sequence - } -} -pub mod r#_Wrappers_Compile { - pub use ::std::fmt::Debug; - pub use ::dafny_runtime::DafnyPrint; - pub use ::std::cmp::Eq; - pub use ::std::hash::Hash; - pub use ::std::default::Default; - pub use ::std::convert::AsRef; - - pub struct _default {} - - impl _default { - pub fn Need<_E: ::dafny_runtime::DafnyType>(condition: bool, error: &_E) -> ::std::rc::Rc> { - if condition { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Outcome::<_E>::Pass {}) - } else { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Outcome::<_E>::Fail { - error: error.clone() - }) - } - } - } - - #[derive(PartialEq, Clone)] - pub enum Option { - None {}, - Some { - value: T - } - } - - impl Option { - pub fn ToResult(self: &::std::rc::Rc) -> ::std::rc::Rc>> { - let mut _source0: ::std::rc::Rc> = self.clone(); - if matches!((&_source0).as_ref(), crate::r#_Wrappers_Compile::Option::None{ .. }) { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::>::Failure { - error: ::dafny_runtime::string_utf16_of("Option is None") - }) - } else { - let mut r#___mcc_h0: T = _source0.value().clone(); - let mut v: T = r#___mcc_h0.clone(); - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::>::Success { - value: v.clone() - }) - } - } - pub fn UnwrapOr(self: &::std::rc::Rc, default: &T) -> T { - let mut _source1: ::std::rc::Rc> = self.clone(); - if matches!((&_source1).as_ref(), crate::r#_Wrappers_Compile::Option::None{ .. }) { - default.clone() - } else { - let mut r#___mcc_h0: T = _source1.value().clone(); - let mut v: T = r#___mcc_h0.clone(); - v.clone() - } - } - pub fn IsFailure(self: &::std::rc::Rc) -> bool { - matches!(self.as_ref(), crate::r#_Wrappers_Compile::Option::None{ .. }) - } - pub fn PropagateFailure<_U: ::dafny_runtime::DafnyType>(self: &::std::rc::Rc) -> ::std::rc::Rc> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::<_U>::None {}) - } - pub fn Extract(self: &::std::rc::Rc) -> T { - self.value().clone() - } - pub fn value(&self) -> &T { - match self { - Option::None{} => panic!("field does not exist on this variant"), - Option::Some{value, } => value, - } - } - } - - impl Debug - for Option { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Option { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Option::None{} => { - write!(_formatter, "Wrappers_Compile.Option.None")?; - Ok(()) - }, - Option::Some{value, } => { - write!(_formatter, "Wrappers_Compile.Option.Some(")?; - ::dafny_runtime::DafnyPrint::fmt_print(value, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Option { - pub fn coerce(f_0: ::std::rc::Rc r#__T0 + 'static>) -> ::std::rc::Rc) -> Option> { - ::std::rc::Rc::new(move |this: Self| -> Option{ - match this { - Option::None{} => { - Option::None {} - }, - Option::Some{value, } => { - Option::Some { - value: f_0.clone()(value) - } - }, - } - }) - } - } - - impl Eq - for Option {} - - impl Hash - for Option { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - Option::None{} => { - - }, - Option::Some{value, } => { - ::std::hash::Hash::hash(value, _state) - }, - } - } - } - - impl Default - for Option { - fn default() -> Option { - Option::None {} - } - } - - impl AsRef> - for &Option { - fn as_ref(&self) -> Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Result { - Success { - value: T - }, - Failure { - error: R - } - } - - impl Result { - pub fn ToOption(self: &::std::rc::Rc) -> ::std::rc::Rc> { - let mut _source2: ::std::rc::Rc> = self.clone(); - if matches!((&_source2).as_ref(), crate::r#_Wrappers_Compile::Result::Success{ .. }) { - let mut r#___mcc_h0: T = _source2.value().clone(); - let mut s: T = r#___mcc_h0.clone(); - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::::Some { - value: s.clone() - }) - } else { - let mut r#___mcc_h1: R = _source2.error().clone(); - let mut e: R = r#___mcc_h1.clone(); - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Option::::None {}) - } - } - pub fn UnwrapOr(self: &::std::rc::Rc, default: &T) -> T { - let mut _source3: ::std::rc::Rc> = self.clone(); - if matches!((&_source3).as_ref(), crate::r#_Wrappers_Compile::Result::Success{ .. }) { - let mut r#___mcc_h0: T = _source3.value().clone(); - let mut s: T = r#___mcc_h0.clone(); - s.clone() - } else { - let mut r#___mcc_h1: R = _source3.error().clone(); - let mut e: R = r#___mcc_h1.clone(); - default.clone() - } - } - pub fn IsFailure(self: &::std::rc::Rc) -> bool { - matches!(self.as_ref(), crate::r#_Wrappers_Compile::Result::Failure{ .. }) - } - pub fn PropagateFailure<_U: ::dafny_runtime::DafnyType>(self: &::std::rc::Rc) -> ::std::rc::Rc> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<_U, R>::Failure { - error: self.error().clone() - }) - } - pub fn MapFailure<_NewR: ::dafny_runtime::DafnyType>(self: &::std::rc::Rc, reWrap: &::std::rc::Rc _NewR>) -> ::std::rc::Rc> { - let mut _source4: ::std::rc::Rc> = self.clone(); - if matches!((&_source4).as_ref(), crate::r#_Wrappers_Compile::Result::Success{ .. }) { - let mut r#___mcc_h0: T = _source4.value().clone(); - let mut s: T = r#___mcc_h0.clone(); - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::::Success { - value: s.clone() - }) - } else { - let mut r#___mcc_h1: R = _source4.error().clone(); - let mut e: R = r#___mcc_h1.clone(); - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::::Failure { - error: reWrap(&e) - }) - } - } - pub fn Extract(self: &::std::rc::Rc) -> T { - self.value().clone() - } - pub fn value(&self) -> &T { - match self { - Result::Success{value, } => value, - Result::Failure{error, } => panic!("field does not exist on this variant"), - } - } - pub fn error(&self) -> &R { - match self { - Result::Success{value, } => panic!("field does not exist on this variant"), - Result::Failure{error, } => error, - } - } - } - - impl Debug - for Result { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Result { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Result::Success{value, } => { - write!(_formatter, "Wrappers_Compile.Result.Success(")?; - ::dafny_runtime::DafnyPrint::fmt_print(value, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - Result::Failure{error, } => { - write!(_formatter, "Wrappers_Compile.Result.Failure(")?; - ::dafny_runtime::DafnyPrint::fmt_print(error, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Result { - pub fn coerce(f_0: ::std::rc::Rc r#__T0 + 'static>, f_1: ::std::rc::Rc r#__T1 + 'static>) -> ::std::rc::Rc) -> Result> { - ::std::rc::Rc::new(move |this: Self| -> Result{ - match this { - Result::Success{value, } => { - Result::Success { - value: f_0.clone()(value) - } - }, - Result::Failure{error, } => { - Result::Failure { - error: f_1.clone()(error) - } - }, - } - }) - } - } - - impl Eq - for Result {} - - impl Hash - for Result { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - Result::Success{value, } => { - ::std::hash::Hash::hash(value, _state) - }, - Result::Failure{error, } => { - ::std::hash::Hash::hash(error, _state) - }, - } - } - } - - impl Default - for Result { - fn default() -> Result { - Result::Success { - value: ::std::default::Default::default() - } - } - } - - impl AsRef> - for &Result { - fn as_ref(&self) -> Self { - self - } - } - - #[derive(PartialEq, Clone)] - pub enum Outcome { - Pass {}, - Fail { - error: E - } - } - - impl Outcome { - pub fn IsFailure(self: &::std::rc::Rc) -> bool { - matches!(self.as_ref(), crate::r#_Wrappers_Compile::Outcome::Fail{ .. }) - } - pub fn PropagateFailure<_U: ::dafny_runtime::DafnyType>(self: &::std::rc::Rc) -> ::std::rc::Rc> { - ::std::rc::Rc::new(crate::r#_Wrappers_Compile::Result::<_U, E>::Failure { - error: self.error().clone() - }) - } - pub fn error(&self) -> &E { - match self { - Outcome::Pass{} => panic!("field does not exist on this variant"), - Outcome::Fail{error, } => error, - } - } - } - - impl Debug - for Outcome { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::dafny_runtime::DafnyPrint::fmt_print(self, f, true) - } - } - - impl DafnyPrint - for Outcome { - fn fmt_print(&self, _formatter: &mut ::std::fmt::Formatter, _in_seq: bool) -> std::fmt::Result { - match self { - Outcome::Pass{} => { - write!(_formatter, "Wrappers_Compile.Outcome.Pass")?; - Ok(()) - }, - Outcome::Fail{error, } => { - write!(_formatter, "Wrappers_Compile.Outcome.Fail(")?; - ::dafny_runtime::DafnyPrint::fmt_print(error, _formatter, false)?; - write!(_formatter, ")")?; - Ok(()) - }, - } - } - } - - impl Eq - for Outcome {} - - impl Hash - for Outcome { - fn hash<_H: ::std::hash::Hasher>(&self, _state: &mut _H) { - match self { - Outcome::Pass{} => { - - }, - Outcome::Fail{error, } => { - ::std::hash::Hash::hash(error, _state) - }, - } - } - } - - impl Default - for Outcome { - fn default() -> Outcome { - Outcome::Pass {} - } - } - - impl AsRef> - for &Outcome { - fn as_ref(&self) -> Self { - self - } - } -} \ No newline at end of file diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/lib.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/lib.rs deleted file mode 100644 index 4315dacf4..000000000 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/lib.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![allow(deprecated)] - -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -pub mod client; -pub mod types; - -/// Common errors and error handling utilities. -pub mod error; - -/// All operations that this crate can perform. -pub mod operation; - -mod conversions; - -pub use client::Client; -pub use types::simple_string_config::SimpleStringConfig; diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation.rs index 11a615678..1220a7259 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `GetString` operation. pub mod get_string; @@ -11,4 +12,3 @@ pub mod get_string_utf8; /// Types for the `GetStringUTF8KnownValue` operation. pub mod get_string_utf8_known_value; - diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string.rs index 813f2280e..2ac87c12d 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetString`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -137,9 +139,9 @@ pub use crate::operation::get_string::_get_string_output::GetStringOutput; pub use crate::operation::get_string::_get_string_input::GetStringInput; -mod _get_string_input; +pub(crate) mod _get_string_output; -mod _get_string_output; +pub(crate) mod _get_string_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_input.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_input.rs index 9c0d47f5f..b775cb1bf 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_input.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_input.rs @@ -1,16 +1,18 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetStringInput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::std::string::String>, +pub value: ::std::option::Option<::std::string::String>, } impl GetStringInput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&str> { - self.value.as_deref() - } +pub fn value(&self) -> ::std::option::Option<::std::string::String> { + self.value.clone() +} } impl GetStringInput { /// Creates a new builder-style object to manufacture [`GetStringInput`](crate::operation::operation::GetStringInput). @@ -29,19 +31,19 @@ pub struct GetStringInputBuilder { } impl GetStringInputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { - &self.value - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { + &self.value +} /// Consumes the builder and constructs a [`GetStringInput`](crate::operation::operation::GetStringInput). pub fn build( self, diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_output.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_output.rs index ab6b1fa3c..0f89443a9 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_output.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_output.rs @@ -1,16 +1,18 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetStringOutput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::std::string::String>, +pub value: ::std::option::Option<::std::string::String>, } impl GetStringOutput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&str> { - self.value.as_deref() - } +pub fn value(&self) -> ::std::option::Option<::std::string::String> { + self.value.clone() +} } impl GetStringOutput { /// Creates a new builder-style object to manufacture [`GetStringOutput`](crate::operation::operation::GetStringOutput). @@ -29,19 +31,19 @@ pub struct GetStringOutputBuilder { } impl GetStringOutputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { - &self.value - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { + &self.value +} /// Consumes the builder and constructs a [`GetStringOutput`](crate::operation::operation::GetStringOutput). pub fn build( self, diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/builders.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/builders.rs index ec32b2e2c..e0c6cd015 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/builders.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/builders.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use crate::operation::get_string::_get_string_output::GetStringOutputBuilder; pub use crate::operation::get_string::_get_string_input::GetStringInputBuilder; @@ -21,12 +23,12 @@ impl GetStringInputBuilder { /// #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetStringFluentBuilder { - client: crate::Client, - inner: crate::operation::get_string::builders::GetStringInputBuilder, + client: crate::client::Client, + pub(crate) inner: crate::operation::get_string::builders::GetStringInputBuilder, } impl GetStringFluentBuilder { /// Creates a new `GetString`. - pub(crate) fn new(client: crate::Client) -> Self { + pub(crate) fn new(client: crate::client::Client) -> Self { Self { client, inner: ::std::default::Default::default(), @@ -56,17 +58,17 @@ impl GetStringFluentBuilder { } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.inner = self.inner.value(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value.rs index d6abc77c7..0d9960be0 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetStringKnownValue`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -10,28 +12,27 @@ impl GetStringKnownValue { } pub(crate) async fn send( client: &crate::client::Client, - input: crate::operation::get_string_known_value::GetStringKnownValueInput, + input: crate::operation::get_string_known_value::GetStringInput, ) -> ::std::result::Result< - crate::operation::get_string_known_value::GetStringKnownValueOutput, + crate::operation::get_string_known_value::GetStringOutput, crate::operation::get_string_known_value::GetStringKnownValueError, > { - let inner_input = - crate::conversions::get_string_known_value::_get_string_known_value_input::to_dafny( - input, - ); + let inner_input = crate::conversions::get_string_known_value::_get_string_known_value_input::to_dafny(input); let inner_result = - ::dafny_runtime::md!(client.dafny_client.clone()).GetString(&inner_input); + ::dafny_runtime::md!(client.dafny_client.clone()).GetStringKnownValue(&inner_input); if matches!( inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } ) { - Ok(crate::conversions::get_string_known_value::_get_string_known_value_output::from_dafny(inner_result.value().clone())) - } else { - Err( - crate::conversions::get_string_known_value::from_dafny_error( - inner_result.error().clone(), + Ok( + crate::conversions::get_string_known_value::_get_string_known_value_output::from_dafny( + inner_result.value().clone(), ), ) + } else { + Err(crate::conversions::get_string_known_value::from_dafny_error( + inner_result.error().clone(), + )) } } } @@ -134,13 +135,13 @@ impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetStrin } } -pub use crate::operation::get_string_known_value::_get_string_known_value_output::GetStringKnownValueOutput; +pub use crate::operation::get_string_known_value::_get_string_output::GetStringOutput; -pub use crate::operation::get_string_known_value::_get_string_known_value_input::GetStringKnownValueInput; +pub use crate::operation::get_string_known_value::_get_string_input::GetStringInput; -mod _get_string_known_value_input; +pub(crate) mod _get_string_output; -mod _get_string_known_value_output; +pub(crate) mod _get_string_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_input.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_input.rs new file mode 100644 index 000000000..2eedc4c6b --- /dev/null +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetStringInput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option<::std::string::String>, +} +impl GetStringInput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option<::std::string::String> { + self.value.clone() +} +} +impl GetStringInput { + /// Creates a new builder-style object to manufacture [`GetStringInput`](crate::operation::operation::GetStringInput). + pub fn builder() -> crate::operation::get_string_known_value::builders::GetStringInputBuilder { + crate::operation::get_string_known_value::builders::GetStringInputBuilder::default() + } +} + +/// A builder for [`GetStringInput`](crate::operation::operation::GetStringInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetStringInputBuilder { + pub(crate) value: ::std::option::Option<::std::string::String>, +} +impl GetStringInputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { + &self.value +} + /// Consumes the builder and constructs a [`GetStringInput`](crate::operation::operation::GetStringInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_string_known_value::GetStringInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_string_known_value::GetStringInput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_input.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_input.rs deleted file mode 100644 index b67c3effa..000000000 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_input.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetStringKnownValueInput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::std::string::String>, -} -impl GetStringKnownValueInput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&str> { - self.value.as_deref() - } -} -impl GetStringKnownValueInput { - /// Creates a new builder-style object to manufacture [`GetStringKnownValueInput`](crate::operation::operation::GetStringKnownValueInput). - pub fn builder( - ) -> crate::operation::get_string_known_value::builders::GetStringKnownValueInputBuilder { - crate::operation::get_string_known_value::builders::GetStringKnownValueInputBuilder::default( - ) - } -} - -/// A builder for [`GetStringKnownValueInput`](crate::operation::operation::GetStringKnownValueInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetStringKnownValueInputBuilder { - pub(crate) value: ::std::option::Option<::std::string::String>, -} -impl GetStringKnownValueInputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { - &self.value - } - /// Consumes the builder and constructs a [`GetStringKnownValueInput`](crate::operation::operation::GetStringKnownValueInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_string_known_value::GetStringKnownValueInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_string_known_value::GetStringKnownValueInput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_output.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_output.rs deleted file mode 100644 index 291e692c5..000000000 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_output.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetStringKnownValueOutput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::std::string::String>, -} -impl GetStringKnownValueOutput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&str> { - self.value.as_deref() - } -} -impl GetStringKnownValueOutput { - /// Creates a new builder-style object to manufacture [`GetStringKnownValueOutput`](crate::operation::operation::GetStringKnownValueOutput). - pub fn builder( - ) -> crate::operation::get_string_known_value::builders::GetStringKnownValueOutputBuilder { - crate::operation::get_string_known_value::builders::GetStringKnownValueOutputBuilder::default() - } -} - -/// A builder for [`GetStringKnownValueOutput`](crate::operation::operation::GetStringKnownValueOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetStringKnownValueOutputBuilder { - pub(crate) value: ::std::option::Option<::std::string::String>, -} -impl GetStringKnownValueOutputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { - &self.value - } - /// Consumes the builder and constructs a [`GetStringKnownValueOutput`](crate::operation::operation::GetStringKnownValueOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_string_known_value::GetStringKnownValueOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok( - crate::operation::get_string_known_value::GetStringKnownValueOutput { - value: self.value, - }, - ) - } -} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_output.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_output.rs new file mode 100644 index 000000000..dd7b2a2eb --- /dev/null +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetStringOutput { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option<::std::string::String>, +} +impl GetStringOutput { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option<::std::string::String> { + self.value.clone() +} +} +impl GetStringOutput { + /// Creates a new builder-style object to manufacture [`GetStringOutput`](crate::operation::operation::GetStringOutput). + pub fn builder() -> crate::operation::get_string_known_value::builders::GetStringOutputBuilder { + crate::operation::get_string_known_value::builders::GetStringOutputBuilder::default() + } +} + +/// A builder for [`GetStringOutput`](crate::operation::operation::GetStringOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetStringOutputBuilder { + pub(crate) value: ::std::option::Option<::std::string::String>, +} +impl GetStringOutputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { + &self.value +} + /// Consumes the builder and constructs a [`GetStringOutput`](crate::operation::operation::GetStringOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_string_known_value::GetStringOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_string_known_value::GetStringOutput { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/builders.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/builders.rs index 82b4c7fb3..0d379f9ca 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/builders.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/builders.rs @@ -1,15 +1,17 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_string_known_value::_get_string_known_value_output::GetStringKnownValueOutputBuilder; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::get_string_known_value::_get_string_output::GetStringOutputBuilder; -pub use crate::operation::get_string_known_value::_get_string_known_value_input::GetStringKnownValueInputBuilder; +pub use crate::operation::get_string_known_value::_get_string_input::GetStringInputBuilder; -impl GetStringKnownValueInputBuilder { +impl GetStringInputBuilder { /// Sends a request with this input using the given client. pub async fn send_with( self, client: &crate::Client, ) -> ::std::result::Result< - crate::operation::get_string_known_value::GetStringKnownValueOutput, + crate::operation::get_string_known_value::GetStringOutput, crate::operation::get_string_known_value::GetStringKnownValueError, > { let mut fluent_builder = client.get_string_known_value(); @@ -21,57 +23,52 @@ impl GetStringKnownValueInputBuilder { /// #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetStringKnownValueFluentBuilder { - client: crate::Client, - inner: crate::operation::get_string_known_value::builders::GetStringKnownValueInputBuilder, + client: crate::client::Client, + pub(crate) inner: crate::operation::get_string_known_value::builders::GetStringInputBuilder, } impl GetStringKnownValueFluentBuilder { /// Creates a new `GetStringKnownValue`. - pub(crate) fn new(client: crate::Client) -> Self { + pub(crate) fn new(client: crate::client::Client) -> Self { Self { client, inner: ::std::default::Default::default(), } } /// Access the GetStringKnownValue as a reference. - pub fn as_input( - &self, - ) -> &crate::operation::get_string_known_value::builders::GetStringKnownValueInputBuilder { + pub fn as_input(&self) -> &crate::operation::get_string_known_value::builders::GetStringInputBuilder { &self.inner } /// Sends the request and returns the response. pub async fn send( self, ) -> ::std::result::Result< - crate::operation::get_string_known_value::GetStringKnownValueOutput, + crate::operation::get_string_known_value::GetStringOutput, crate::operation::get_string_known_value::GetStringKnownValueError, > { let input = self .inner .build() - // Using unhandled since GetString doesn't declare any validation, + // Using unhandled since GetStringKnownValue doesn't declare any validation, // and smithy-rs seems to not generate a ValidationError case unless there is // (but isn't that a backwards compatibility problem for output structures?) // Vanilla smithy-rs uses SdkError::construction_failure, // but we aren't using SdkError. - .map_err( - crate::operation::get_string_known_value::GetStringKnownValueError::unhandled, - )?; - crate::operation::get_string_known_value::GetStringKnownValue::send(&self.client, input) - .await + .map_err(crate::operation::get_string_known_value::GetStringKnownValueError::unhandled)?; + crate::operation::get_string_known_value::GetStringKnownValue::send(&self.client, input).await } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.inner = self.inner.value(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8.rs index 966f21525..d27e04785 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetStringUTF8`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -15,8 +17,7 @@ impl GetStringUTF8 { crate::operation::get_string_utf8::GetStringUTF8Output, crate::operation::get_string_utf8::GetStringUTF8Error, > { - let inner_input = - crate::conversions::get_string_utf8::_get_string_utf8_input::to_dafny(input); + let inner_input = crate::conversions::get_string_utf8::_get_string_utf8_input::to_dafny(input); let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()).GetStringUTF8(&inner_input); if matches!( @@ -138,9 +139,9 @@ pub use crate::operation::get_string_utf8::_get_string_utf8_output::GetStringUTF pub use crate::operation::get_string_utf8::_get_string_utf8_input::GetStringUTF8Input; -mod _get_string_utf8_input; +pub(crate) mod _get_string_utf8_output; -mod _get_string_utf8_output; +pub(crate) mod _get_string_utf8_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_input.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_input.rs index a448688ed..8950b2a8c 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_input.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_input.rs @@ -1,16 +1,18 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetStringUTF8Input { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::std::string::String>, +pub value: ::std::option::Option<::std::string::String>, } impl GetStringUTF8Input { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&str> { - self.value.as_deref() - } +pub fn value(&self) -> ::std::option::Option<::std::string::String> { + self.value.clone() +} } impl GetStringUTF8Input { /// Creates a new builder-style object to manufacture [`GetStringUTF8Input`](crate::operation::operation::GetStringUTF8Input). @@ -29,19 +31,19 @@ pub struct GetStringUTF8InputBuilder { } impl GetStringUTF8InputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { - &self.value - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { + &self.value +} /// Consumes the builder and constructs a [`GetStringUTF8Input`](crate::operation::operation::GetStringUTF8Input). pub fn build( self, diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_output.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_output.rs index 2c8dca6a8..bb7220129 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_output.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_output.rs @@ -1,16 +1,18 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetStringUTF8Output { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::std::string::String>, +pub value: ::std::option::Option<::std::string::String>, } impl GetStringUTF8Output { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&str> { - self.value.as_deref() - } +pub fn value(&self) -> ::std::option::Option<::std::string::String> { + self.value.clone() +} } impl GetStringUTF8Output { /// Creates a new builder-style object to manufacture [`GetStringUTF8Output`](crate::operation::operation::GetStringUTF8Output). @@ -29,19 +31,19 @@ pub struct GetStringUTF8OutputBuilder { } impl GetStringUTF8OutputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { - &self.value - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { + &self.value +} /// Consumes the builder and constructs a [`GetStringUTF8Output`](crate::operation::operation::GetStringUTF8Output). pub fn build( self, diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/builders.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/builders.rs index 26bf3d9e2..2291919ec 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/builders.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/builders.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use crate::operation::get_string_utf8::_get_string_utf8_output::GetStringUTF8OutputBuilder; pub use crate::operation::get_string_utf8::_get_string_utf8_input::GetStringUTF8InputBuilder; @@ -21,21 +23,19 @@ impl GetStringUTF8InputBuilder { /// #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetStringUTF8FluentBuilder { - client: crate::Client, - inner: crate::operation::get_string_utf8::builders::GetStringUTF8InputBuilder, + client: crate::client::Client, + pub(crate) inner: crate::operation::get_string_utf8::builders::GetStringUTF8InputBuilder, } impl GetStringUTF8FluentBuilder { /// Creates a new `GetStringUTF8`. - pub(crate) fn new(client: crate::Client) -> Self { + pub(crate) fn new(client: crate::client::Client) -> Self { Self { client, inner: ::std::default::Default::default(), } } /// Access the GetStringUTF8 as a reference. - pub fn as_input( - &self, - ) -> &crate::operation::get_string_utf8::builders::GetStringUTF8InputBuilder { + pub fn as_input(&self) -> &crate::operation::get_string_utf8::builders::GetStringUTF8InputBuilder { &self.inner } /// Sends the request and returns the response. @@ -48,7 +48,7 @@ impl GetStringUTF8FluentBuilder { let input = self .inner .build() - // Using unhandled since GetString doesn't declare any validation, + // Using unhandled since GetStringUTF8 doesn't declare any validation, // and smithy-rs seems to not generate a ValidationError case unless there is // (but isn't that a backwards compatibility problem for output structures?) // Vanilla smithy-rs uses SdkError::construction_failure, @@ -58,17 +58,17 @@ impl GetStringUTF8FluentBuilder { } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.inner = self.inner.value(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value.rs index 16b06252a..47bb6d9ea 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetStringUTF8KnownValue`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -10,13 +12,12 @@ impl GetStringUTF8KnownValue { } pub(crate) async fn send( client: &crate::client::Client, - input: crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueInput, + input: crate::operation::get_string_utf8_known_value::GetStringUTF8Input, ) -> ::std::result::Result< - crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueOutput, + crate::operation::get_string_utf8_known_value::GetStringUTF8Output, crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueError, > { - let inner_input = - crate::conversions::get_string_utf8_known_value::_get_string_utf8_known_value_input::to_dafny(input); + let inner_input = crate::conversions::get_string_utf8_known_value::_get_string_utf8_known_value_input::to_dafny(input); let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()).GetStringUTF8KnownValue(&inner_input); if matches!( @@ -134,13 +135,13 @@ impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetStrin } } -pub use crate::operation::get_string_utf8_known_value::_get_string_utf8_known_value_output::GetStringUTF8KnownValueOutput; +pub use crate::operation::get_string_utf8_known_value::_get_string_utf8_output::GetStringUTF8Output; -pub use crate::operation::get_string_utf8_known_value::_get_string_utf8_known_value_input::GetStringUTF8KnownValueInput; +pub use crate::operation::get_string_utf8_known_value::_get_string_utf8_input::GetStringUTF8Input; -mod _get_string_utf8_known_value_input; +pub(crate) mod _get_string_utf8_output; -mod _get_string_utf8_known_value_output; +pub(crate) mod _get_string_utf8_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_input.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_input.rs new file mode 100644 index 000000000..6e21c111b --- /dev/null +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetStringUTF8Input { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option<::std::string::String>, +} +impl GetStringUTF8Input { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option<::std::string::String> { + self.value.clone() +} +} +impl GetStringUTF8Input { + /// Creates a new builder-style object to manufacture [`GetStringUTF8Input`](crate::operation::operation::GetStringUTF8Input). + pub fn builder() -> crate::operation::get_string_utf8_known_value::builders::GetStringUTF8InputBuilder { + crate::operation::get_string_utf8_known_value::builders::GetStringUTF8InputBuilder::default() + } +} + +/// A builder for [`GetStringUTF8Input`](crate::operation::operation::GetStringUTF8Input). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetStringUTF8InputBuilder { + pub(crate) value: ::std::option::Option<::std::string::String>, +} +impl GetStringUTF8InputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { + &self.value +} + /// Consumes the builder and constructs a [`GetStringUTF8Input`](crate::operation::operation::GetStringUTF8Input). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_string_utf8_known_value::GetStringUTF8Input, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_string_utf8_known_value::GetStringUTF8Input { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_known_value_input.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_known_value_input.rs deleted file mode 100644 index 6b73af0d8..000000000 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_known_value_input.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetStringUTF8KnownValueInput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::std::string::String>, -} -impl GetStringUTF8KnownValueInput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&str> { - self.value.as_deref() - } -} -impl GetStringUTF8KnownValueInput { - /// Creates a new builder-style object to manufacture [`GetStringUTF8KnownValueInput`](crate::operation::operation::GetStringUTF8KnownValueInput). - pub fn builder() -> crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueInputBuilder { - crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueInputBuilder::default() - } -} - -/// A builder for [`GetStringUTF8KnownValueInput`](crate::operation::operation::GetStringUTF8KnownValueInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetStringUTF8KnownValueInputBuilder { - pub(crate) value: ::std::option::Option<::std::string::String>, -} -impl GetStringUTF8KnownValueInputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { - &self.value - } - /// Consumes the builder and constructs a [`GetStringUTF8KnownValueInput`](crate::operation::operation::GetStringUTF8KnownValueInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueInput { - value: self.value, - }) - } -} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_known_value_output.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_known_value_output.rs deleted file mode 100644 index 8c7712608..000000000 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_known_value_output.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -#[allow(missing_docs)] // documentation missing in model -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct GetStringUTF8KnownValueOutput { - #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::std::string::String>, -} -impl GetStringUTF8KnownValueOutput { - #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&str> { - self.value.as_deref() - } -} -impl GetStringUTF8KnownValueOutput { - /// Creates a new builder-style object to manufacture [`GetStringUTF8KnownValueOutput`](crate::operation::operation::GetStringUTF8KnownValueOutput). - pub fn builder() -> crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueOutputBuilder { - crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueOutputBuilder::default() - } -} - -/// A builder for [`GetStringUTF8KnownValueOutput`](crate::operation::operation::GetStringUTF8KnownValueOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct GetStringUTF8KnownValueOutputBuilder { - pub(crate) value: ::std::option::Option<::std::string::String>, -} -impl GetStringUTF8KnownValueOutputBuilder { - #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.value = ::std::option::Option::Some(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { - &self.value - } - /// Consumes the builder and constructs a [`GetStringUTF8KnownValueOutput`](crate::operation::operation::GetStringUTF8KnownValueOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueOutput { - value: self.value, - }) - } -} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_output.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_output.rs new file mode 100644 index 000000000..f1dfb24b6 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/_get_string_utf8_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetStringUTF8Output { + #[allow(missing_docs)] // documentation missing in model +pub value: ::std::option::Option<::std::string::String>, +} +impl GetStringUTF8Output { + #[allow(missing_docs)] // documentation missing in model +pub fn value(&self) -> ::std::option::Option<::std::string::String> { + self.value.clone() +} +} +impl GetStringUTF8Output { + /// Creates a new builder-style object to manufacture [`GetStringUTF8Output`](crate::operation::operation::GetStringUTF8Output). + pub fn builder() -> crate::operation::get_string_utf8_known_value::builders::GetStringUTF8OutputBuilder { + crate::operation::get_string_utf8_known_value::builders::GetStringUTF8OutputBuilder::default() + } +} + +/// A builder for [`GetStringUTF8Output`](crate::operation::operation::GetStringUTF8Output). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct GetStringUTF8OutputBuilder { + pub(crate) value: ::std::option::Option<::std::string::String>, +} +impl GetStringUTF8OutputBuilder { + #[allow(missing_docs)] // documentation missing in model +pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { + &self.value +} + /// Consumes the builder and constructs a [`GetStringUTF8Output`](crate::operation::operation::GetStringUTF8Output). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_string_utf8_known_value::GetStringUTF8Output, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_string_utf8_known_value::GetStringUTF8Output { + value: self.value, + }) + } +} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/builders.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/builders.rs index 0b29a00e1..c6e957eee 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/builders.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8_known_value/builders.rs @@ -1,15 +1,17 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::operation::get_string_utf8_known_value::_get_string_utf8_known_value_output::GetStringUTF8KnownValueOutputBuilder; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::get_string_utf8_known_value::_get_string_utf8_output::GetStringUTF8OutputBuilder; -pub use crate::operation::get_string_utf8_known_value::_get_string_utf8_known_value_input::GetStringUTF8KnownValueInputBuilder; +pub use crate::operation::get_string_utf8_known_value::_get_string_utf8_input::GetStringUTF8InputBuilder; -impl GetStringUTF8KnownValueInputBuilder { +impl GetStringUTF8InputBuilder { /// Sends a request with this input using the given client. pub async fn send_with( self, client: &crate::Client, ) -> ::std::result::Result< - crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueOutput, + crate::operation::get_string_utf8_known_value::GetStringUTF8Output, crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueError, > { let mut fluent_builder = client.get_string_utf8_known_value(); @@ -21,34 +23,32 @@ impl GetStringUTF8KnownValueInputBuilder { /// #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetStringUTF8KnownValueFluentBuilder { - client: crate::Client, - inner: crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueInputBuilder, + client: crate::client::Client, + pub(crate) inner: crate::operation::get_string_utf8_known_value::builders::GetStringUTF8InputBuilder, } impl GetStringUTF8KnownValueFluentBuilder { /// Creates a new `GetStringUTF8KnownValue`. - pub(crate) fn new(client: crate::Client) -> Self { + pub(crate) fn new(client: crate::client::Client) -> Self { Self { client, inner: ::std::default::Default::default(), } } /// Access the GetStringUTF8KnownValue as a reference. - pub fn as_input( - &self, - ) -> &crate::operation::get_string_utf8_known_value::builders::GetStringUTF8KnownValueInputBuilder { + pub fn as_input(&self) -> &crate::operation::get_string_utf8_known_value::builders::GetStringUTF8InputBuilder { &self.inner } /// Sends the request and returns the response. pub async fn send( self, ) -> ::std::result::Result< - crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueOutput, + crate::operation::get_string_utf8_known_value::GetStringUTF8Output, crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValueError, > { let input = self .inner .build() - // Using unhandled since GetString doesn't declare any validation, + // Using unhandled since GetStringUTF8KnownValue doesn't declare any validation, // and smithy-rs seems to not generate a ValidationError case unless there is // (but isn't that a backwards compatibility problem for output structures?) // Vanilla smithy-rs uses SdkError::construction_failure, @@ -58,17 +58,17 @@ impl GetStringUTF8KnownValueFluentBuilder { } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.inner = self.inner.value(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/standard_library_conversions.rs index 3a51134c6..6bf8297d8 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/standard_library_conversions.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/standard_library_conversions.rs @@ -1,246 +1,266 @@ pub fn ostring_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, > { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) - }, - None => crate::_Wrappers_Compile::Option::None {}, + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) + }, + None => crate::_Wrappers_Compile::Option::None {}, }; - ::std::rc::Rc::new(dafny_value) + ::std::rc::Rc::new(dafny_value) } pub fn ostring_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, - >, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input.Extract(), - ), - ) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some( + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input.Extract(), + ), + ) + } else { + None + } } -pub fn obool_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn obool_to_dafny( + input: &Option, +) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn obool_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn obool_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn olong_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn olong_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn olong_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn blob_to_dafny( - input: &::aws_smithy_types::Blob, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) +pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) } pub fn oblob_to_dafny( - input: &Option<::aws_smithy_types::Blob>, + input: &Option<::aws_smithy_types::Blob>, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: blob_to_dafny(&b), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { + value: blob_to_dafny(&b), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn blob_from_dafny( - input: ::dafny_runtime::Sequence, -) -> ::aws_smithy_types::Blob { - - ::aws_smithy_types::Blob::new( - ::std::rc::Rc::try_unwrap(input.to_array()) - .unwrap_or_else(|rc| (*rc).clone()), - ) +pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { + ::aws_smithy_types::Blob::new( + ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), + ) } pub fn oblob_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option<::aws_smithy_types::Blob> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(blob_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(blob_from_dafny(input.Extract())) + } else { + None + } } -pub fn double_to_dafny( - input: f64, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( - &f64::to_be_bytes(input).to_vec(), - |x| *x) +pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( + &f64::to_be_bytes(input).to_vec(), + |x| *x, + ) } pub fn odouble_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: double_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: double_to_dafny(*f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn double_from_dafny( - input: &::dafny_runtime::Sequence, -) -> f64 { - let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); - f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) +pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { + let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); + f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) } pub fn odouble_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(double_from_dafny(&input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(double_from_dafny(&input.Extract())) + } else { + None + } } pub fn timestamp_to_dafny( - input: ::aws_smithy_types::DateTime, + input: &::aws_smithy_types::DateTime, ) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&input.to_string()) + ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &input.to_string(), + ) } pub fn otimestamp_to_dafny( - input: &Option<::aws_smithy_types::DateTime>, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: timestamp_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + input: &Option<::aws_smithy_types::DateTime>, +) -> ::std::rc::Rc< + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, +> { + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: timestamp_to_dafny(f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn timestamp_from_dafny( - input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, ) -> ::aws_smithy_types::DateTime { - let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&input); - ::aws_smithy_types::DateTime::from_str( - &s, - aws_smithy_types::date_time::Format::DateTime, - ).unwrap() + let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input, + ); + ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) + .unwrap() } pub fn otimestamp_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option<::aws_smithy_types::DateTime> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(timestamp_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(timestamp_from_dafny(input.Extract())) + } else { + None + } } pub fn option_from_dafny( - input: ::std::rc::Rc>, - converter: fn(&T) -> TR, + input: ::std::rc::Rc>, + converter: fn(&T) -> TR, ) -> Option { - match &*input { - crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), - crate::_Wrappers_Compile::Option::None { } => None, - } + match &*input { + crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), + crate::_Wrappers_Compile::Option::None {} => None, + } } pub fn option_to_dafny( - input: &Option, - converter: fn(&TR) -> T, + input: &Option, + converter: fn(&TR) -> T, ) -> ::std::rc::Rc> { - match input { - Some(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::Some { - value: converter(&value) - } - ), - None => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::None {} - ), - } + match input { + Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { + value: converter(&value), + }), + None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), + } } pub fn result_from_dafny( - input: ::std::rc::Rc>, - converter_t: fn(&T) -> TR, - converter_e: fn(&E) -> ER, + input: ::std::rc::Rc>, + converter_t: fn(&T) -> TR, + converter_e: fn(&E) -> ER, ) -> Result { - match &*input { - crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), - crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), - } + match &*input { + crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), + crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), + } } pub fn result_to_dafny( - input: &Result, - converter_t: fn(&TR) -> T, - converter_e: fn(&ER) -> E, + input: &Result, + converter_t: fn(&TR) -> T, + converter_e: fn(&ER) -> E, ) -> ::std::rc::Rc> { - match input { - Ok(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: converter_t(&value) - } - ), - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: converter_e(&error) - } - ), - } -} \ No newline at end of file + match input { + Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { + value: converter_t(&value), + }), + Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { + error: converter_e(&error), + }), + } +} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/standard_library_externs.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types.rs index 7ec746092..9e117395c 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types.rs @@ -1,4 +1,5 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `SimpleStringConfig` pub mod simple_string_config; diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types/simple_string_config.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types/simple_string_config.rs index 6b9ec61a0..94d186d22 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types/simple_string_config.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types/simple_string_config.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct SimpleStringConfig {} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/wrapped.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/wrapped.rs new file mode 100644 index 000000000..4f32d02ae --- /dev/null +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/wrapped.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod client; + +impl crate::r#simple::types::smithystring::internaldafny::wrapped::_default { + pub fn WrappedSimpleString(config: &::std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::SimpleStringConfig, + >) -> ::std::rc::Rc, + ::std::rc::Rc + >>{ + crate::wrapped::client::Client::from_conf(config) + } +} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/wrapped/client.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/wrapped/client.rs new file mode 100644 index 000000000..f89535dd1 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/wrapped/client.rs @@ -0,0 +1,179 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use tokio::runtime::Runtime; + +pub struct Client { + wrapped: crate::client::Client, + + /// A `current_thread` runtime for executing operations on the + /// asynchronous client in a blocking manner. + rt: Runtime +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn crate::r#simple::types::smithystring::internaldafny::types::ISimpleTypesStringClient); +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); +} + +impl Client { + pub fn from_conf(config: &::std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::SimpleStringConfig, + >) -> +::std::rc::Rc, + ::std::rc::Rc +>> { + let rt_result = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build(); + let rt = match rt_result { + Ok(x) => x, + Err(error) => return crate::conversions::error::to_opaque_error_result(error), + }; + let result = crate::client::Client::from_conf( + crate::conversions::simple_string_config::_simple_string_config::from_dafny( + config.clone(), + ), + ); + match result { + Ok(client) => { + let wrap = crate::wrapped::client::Client { + wrapped: client, + rt + }; + std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(wrap)) + } + ) + }, + Err(error) => crate::conversions::error::to_opaque_error_result(error) + } + } +} + +impl crate::r#simple::types::smithystring::internaldafny::types::ISimpleTypesStringClient for Client { + fn GetString( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::GetStringInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::GetStringOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_string::_get_string_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_string::GetString::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_string::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_string::_get_string_output::to_dafny(client), + }, + ), + } + } + + fn GetStringKnownValue( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::GetStringInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::GetStringOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_string_known_value::_get_string_known_value_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_string_known_value::GetStringKnownValue::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_string_known_value::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_string_known_value::_get_string_known_value_output::to_dafny(client), + }, + ), + } + } + + fn GetStringUTF8( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Input, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Output, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_string_utf8::_get_string_utf8_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_string_utf8::GetStringUTF8::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_string_utf8::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_string_utf8::_get_string_utf8_output::to_dafny(client), + }, + ), + } + } + + fn GetStringUTF8KnownValue( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Input, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::smithystring::internaldafny::types::GetStringUTF8Output, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_string_utf8_known_value::_get_string_utf8_known_value_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_string_utf8_known_value::GetStringUTF8KnownValue::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_string_utf8_known_value::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_string_utf8_known_value::_get_string_utf8_known_value_output::to_dafny(client), + }, + ), + } + } +} diff --git a/TestModels/SimpleTypes/SimpleTimestamp/Makefile b/TestModels/SimpleTypes/SimpleTimestamp/Makefile index 6575072c5..55d0f10c8 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/Makefile +++ b/TestModels/SimpleTypes/SimpleTimestamp/Makefile @@ -3,8 +3,9 @@ CORES=2 +TRANSPILE_TESTS_IN_RUST=1 + ENABLE_EXTERN_PROCESSING=1 -RUST_BENERATED=1 include ../../SharedMakefile.mk @@ -22,10 +23,8 @@ SMITHY_DEPS=dafny-dependencies/Model/traits.smithy # This project has no dependencies # DEPENDENT-MODELS:= - POLYMORPH_OPTIONS=--generate client-constructors,project-files - # Constants for languages that drop extern names (Python, Go) TYPES_FILE_PATH=Model/SimpleTypesTimestampTypes.dfy diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/Cargo.toml b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/Cargo.toml index 94927ac48..de5d41946 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/Cargo.toml +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/Cargo.toml @@ -5,14 +5,21 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +wrapped-client = [] + [dependencies] -dafny_runtime = { path = "../../../../dafny-dependencies/dafny_runtime_rust"} aws-smithy-runtime = { version = "1.6.0", features = ["client"] } aws-smithy-runtime-api = { version = "1.7.0", features = ["client"] } aws-smithy-types = "1.2.0" +dafny_runtime = { path = "../../../../dafny-dependencies/dafny_runtime_rust"} [dev-dependencies] -tokio = { version = "1.26.0", features = ["full"] } +simple_timestamp = { path = ".", features = ["wrapped-client"] } + +[dependencies.tokio] +version = "1.26.0" +features = ["full"] [lib] path = "src/implementation_from_dafny.rs" diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client.rs index 1691812f1..c87832fe2 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use aws_smithy_types::error::operation::BuildError; #[derive(::std::clone::Clone, ::std::fmt::Debug)] @@ -29,7 +30,7 @@ impl Client { )); } Ok(Self { - dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), + dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) }) } } diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client/get_timestamp.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client/get_timestamp.rs index 9004f4f30..e272f7675 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client/get_timestamp.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client/get_timestamp.rs @@ -1,15 +1,15 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. impl super::Client { /// Constructs a fluent builder for the [`GetTimestamp`](crate::operation::get_timestamp::builders::GetTimestampFluentBuilder) operation. /// /// - The fluent builder is configurable: - /// - [`value(DateTime)`](crate::operation::get_timestamp::builders::GetTimestampFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_timestamp::builders::GetTimestampFluentBuilder::set_value):
required: **false**
(undocumented)
+ /// - [`value(impl Into>)`](crate::operation::get_timestamp::builders::GetTimestampFluentBuilder::value) / [`set_value(Option<::aws_smithy_types::DateTime>)`](crate::operation::get_timestamp::builders::GetTimestampFluentBuilder::set_value): (undocumented)
/// - On success, responds with [`GetTimestampOutput`](crate::operation::get_timestamp::GetTimestampOutput) with field(s): - /// - [`value(Option)`](crate::operation::get_timestamp::GetTimestampOutput::value): (undocumented) + /// - [`value(Option<::aws_smithy_types::DateTime>)`](crate::operation::get_timestamp::GetTimestampOutput::value): (undocumented) /// - On failure, responds with [`SdkError`](crate::operation::get_timestamp::GetTimestampError) - pub fn get_timestamp( - &self, - ) -> crate::operation::get_timestamp::builders::GetTimestampFluentBuilder { + pub fn get_timestamp(&self) -> crate::operation::get_timestamp::builders::GetTimestampFluentBuilder { crate::operation::get_timestamp::builders::GetTimestampFluentBuilder::new(self.clone()) } } diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions.rs index 6c19c684d..85c9ba3aa 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions.rs @@ -1,4 +1,8 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub mod get_timestamp; +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod error; -pub mod simple_timestamp_config; + pub mod get_timestamp; + + pub mod simple_timestamp_config; diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/error.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/error.rs new file mode 100644 index 000000000..255fc9700 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/error.rs @@ -0,0 +1,32 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + /// Wraps up an arbitrary Rust Error value as a Dafny Error +pub fn to_opaque_error(value: E) -> + ::std::rc::Rc +{ + let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( + ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), + )); + ::std::rc::Rc::new( + crate::r#simple::types::timestamp::internaldafny::types::Error::Opaque { + obj: error_obj, + }, + ) +} + +/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure +pub fn to_opaque_error_result(value: E) -> + ::std::rc::Rc< + crate::_Wrappers_Compile::Result< + T, + ::std::rc::Rc + > + > +{ + ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: to_opaque_error(value), + }, + ) +} diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp.rs index 64d9cf3a1..e96799af6 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp.rs @@ -1,12 +1,12 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. use std::any::Any; #[allow(dead_code)] pub fn to_dafny_error( value: crate::operation::get_timestamp::GetTimestampError, -) -> ::std::rc::Rc -{ +) -> ::std::rc::Rc { match value { crate::operation::get_timestamp::GetTimestampError::Unhandled(unhandled) => ::std::rc::Rc::new(crate::r#simple::types::timestamp::internaldafny::types::Error::Opaque { obj: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(unhandled)) }) diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_input.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_input.rs index ec1fde893..b42a09156 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_input.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_input.rs @@ -1,39 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_timestamp::GetTimestampInput, ) -> ::std::rc::Rc< crate::r#simple::types::timestamp::internaldafny::types::GetTimestampInput, -> { - let dafny_value = match value.value { - Some(s) => crate::_Wrappers_Compile::Option::Some { value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s.to_string()) }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::timestamp::internaldafny::types::GetTimestampInput::GetTimestampInput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::otimestamp_to_dafny(&value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::timestamp::internaldafny::types::GetTimestampInput, >, -) -> Result< - crate::operation::get_timestamp::GetTimestampInput, - aws_smithy_types::date_time::DateTimeParseError, -> { - let value = match dafny_value.value().as_ref() { - crate::_Wrappers_Compile::Option::None {} => None, - crate::_Wrappers_Compile::Option::Some { value } => { - let value = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&value); - let value = ::aws_smithy_types::DateTime::from_str( - &value, - aws_smithy_types::date_time::Format::DateTime, - )?; - Some(value) - } - }; - - Ok(crate::operation::get_timestamp::GetTimestampInput { value }) +) -> crate::operation::get_timestamp::GetTimestampInput { + crate::operation::get_timestamp::GetTimestampInput::builder() + .set_value(crate::standard_library_conversions::otimestamp_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_output.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_output.rs index 958069da0..09e9489bd 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_output.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_output.rs @@ -1,39 +1,24 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::operation::get_timestamp::GetTimestampOutput, ) -> ::std::rc::Rc< crate::r#simple::types::timestamp::internaldafny::types::GetTimestampOutput, -> { - let dafny_value = match value.value { - Some(s) => crate::_Wrappers_Compile::Option::Some { value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s.to_string()) }, - None => crate::_Wrappers_Compile::Option::None {}, - }; +>{ ::std::rc::Rc::new(crate::r#simple::types::timestamp::internaldafny::types::GetTimestampOutput::GetTimestampOutput { - value: ::std::rc::Rc::new(dafny_value) - }) + value: crate::standard_library_conversions::otimestamp_to_dafny(&value.value), + }) } - -#[allow(dead_code)] + #[allow(dead_code)] pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#simple::types::timestamp::internaldafny::types::GetTimestampOutput, >, -) -> Result< - crate::operation::get_timestamp::GetTimestampOutput, - aws_smithy_types::date_time::DateTimeParseError, -> { - let value = match dafny_value.value().as_ref() { - crate::_Wrappers_Compile::Option::None {} => None, - crate::_Wrappers_Compile::Option::Some { value } => { - let value = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&value); - let value = ::aws_smithy_types::DateTime::from_str( - &value, - aws_smithy_types::date_time::Format::DateTime, - )?; - Some(value) - } - }; - - Ok(crate::operation::get_timestamp::GetTimestampOutput { value }) +) -> crate::operation::get_timestamp::GetTimestampOutput { + crate::operation::get_timestamp::GetTimestampOutput::builder() + .set_value(crate::standard_library_conversions::otimestamp_from_dafny(dafny_value.value().clone())) + .build() + .unwrap() } diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config.rs index 3ab144902..f4c49447c 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config.rs @@ -1,3 +1,4 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub mod _simple_timestamp_config; diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config/_simple_timestamp_config.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config/_simple_timestamp_config.rs index 7a6ad17f9..65be65a35 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config/_simple_timestamp_config.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config/_simple_timestamp_config.rs @@ -1,11 +1,13 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(dead_code)] pub fn to_dafny( value: crate::types::simple_timestamp_config::SimpleTimestampConfig, ) -> ::std::rc::Rc< - crate::simple::types::timestamp::internaldafny::types::SimpleTimestampConfig, ->{ + crate::r#simple::types::timestamp::internaldafny::types::SimpleTimestampConfig, +> { ::std::rc::Rc::new(crate::r#simple::types::timestamp::internaldafny::types::SimpleTimestampConfig::SimpleTimestampConfig {}) } diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error.rs index ec89cbecc..4cddaa7c3 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use ::aws_smithy_runtime_api::box_error::BoxError; /// Error type returned by the client. diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error/sealed_unhandled.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error/sealed_unhandled.rs index cce22d1cf..eae800729 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error/sealed_unhandled.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error/sealed_unhandled.rs @@ -1,4 +1,10 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::any::Any; + +use dafny_runtime::UpcastObject; + /// This struct is not intended to be used. /// /// This struct holds information about an unhandled error, @@ -21,6 +27,6 @@ pub struct Unhandled { pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, } -impl ::dafny_runtime::UpcastObject for Unhandled { +impl UpcastObject for Unhandled { ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); } diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/lib.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/lib.rs deleted file mode 100644 index 4e55b724c..000000000 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/lib.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![allow(deprecated)] - -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - -pub mod client; -pub mod types; - -/// Common errors and error handling utilities. -pub mod error; - -/// All operations that this crate can perform. -pub mod operation; - -mod conversions; - -pub mod implementation_from_dafny; - -pub use client::Client; -pub use types::simple_timestamp_config::SimpleTimestampConfig; diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation.rs index 14ae6ca55..e1bae1274 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation.rs @@ -1,4 +1,5 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `GetTimestamp` operation. pub mod get_timestamp; diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp.rs index 27f406c72..a393c9880 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Orchestration and serialization glue logic for `GetTimestamp`. #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] #[non_exhaustive] @@ -22,10 +24,11 @@ impl GetTimestamp { inner_result.as_ref(), crate::r#_Wrappers_Compile::Result::Success { .. } ) { - crate::conversions::get_timestamp::_get_timestamp_output::from_dafny( - inner_result.value().clone(), + Ok( + crate::conversions::get_timestamp::_get_timestamp_output::from_dafny( + inner_result.value().clone(), + ), ) - .map_err(crate::operation::get_timestamp::GetTimestampError::unhandled) } else { Err(crate::conversions::get_timestamp::from_dafny_error( inner_result.error().clone(), @@ -136,9 +139,9 @@ pub use crate::operation::get_timestamp::_get_timestamp_output::GetTimestampOutp pub use crate::operation::get_timestamp::_get_timestamp_input::GetTimestampInput; -mod _get_timestamp_input; +pub(crate) mod _get_timestamp_output; -mod _get_timestamp_output; +pub(crate) mod _get_timestamp_input; /// Builders pub mod builders; diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_input.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_input.rs index acf259d31..1155b34c9 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_input.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_input.rs @@ -1,25 +1,27 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetTimestampInput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::aws_smithy_types::DateTime>, +pub value: ::std::option::Option<::aws_smithy_types::DateTime>, } impl GetTimestampInput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { - self.value.as_ref() - } +pub fn value(&self) -> ::std::option::Option<::aws_smithy_types::DateTime> { + self.value +} } impl GetTimestampInput { - /// Creates a new builder-style object to manufacture [`GetTimestampInput`](crate::operation::get_timestamp::GetTimestampInput). + /// Creates a new builder-style object to manufacture [`GetTimestampInput`](crate::operation::operation::GetTimestampInput). pub fn builder() -> crate::operation::get_timestamp::builders::GetTimestampInputBuilder { crate::operation::get_timestamp::builders::GetTimestampInputBuilder::default() } } -/// A builder for [`GetTimestampInput`](crate::operation::get_timestamp::GetTimestampInput). +/// A builder for [`GetTimestampInput`](crate::operation::operation::GetTimestampInput). #[non_exhaustive] #[derive( ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, @@ -29,20 +31,20 @@ pub struct GetTimestampInputBuilder { } impl GetTimestampInputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: ::aws_smithy_types::DateTime) -> Self { - self.value = ::std::option::Option::Some(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { - &self.value - } - /// Consumes the builder and constructs a [`GetTimestampInput`](crate::operation::get_timestamp::GetTimestampInput). +pub fn value(mut self, input: impl ::std::convert::Into<::aws_smithy_types::DateTime>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.value +} + /// Consumes the builder and constructs a [`GetTimestampInput`](crate::operation::operation::GetTimestampInput). pub fn build( self, ) -> ::std::result::Result< diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_output.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_output.rs index 711324b3a..c4f3ab84e 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_output.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_output.rs @@ -1,25 +1,27 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] pub struct GetTimestampOutput { #[allow(missing_docs)] // documentation missing in model - pub value: ::std::option::Option<::aws_smithy_types::DateTime>, +pub value: ::std::option::Option<::aws_smithy_types::DateTime>, } impl GetTimestampOutput { #[allow(missing_docs)] // documentation missing in model - pub fn value(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { - self.value.as_ref() - } +pub fn value(&self) -> ::std::option::Option<::aws_smithy_types::DateTime> { + self.value +} } impl GetTimestampOutput { - /// Creates a new builder-style object to manufacture [`GetTimestampOutput`](crate::operation::get_timestamp::GetTimestampOutput). + /// Creates a new builder-style object to manufacture [`GetTimestampOutput`](crate::operation::operation::GetTimestampOutput). pub fn builder() -> crate::operation::get_timestamp::builders::GetTimestampOutputBuilder { crate::operation::get_timestamp::builders::GetTimestampOutputBuilder::default() } } -/// A builder for [`GetTimestampOutput`](crate::operation::get_timestamp::GetTimestampOutput). +/// A builder for [`GetTimestampOutput`](crate::operation::operation::GetTimestampOutput). #[non_exhaustive] #[derive( ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, @@ -29,21 +31,28 @@ pub struct GetTimestampOutputBuilder { } impl GetTimestampOutputBuilder { #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: ::aws_smithy_types::DateTime) -> Self { - self.value = ::std::option::Option::Some(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { - self.value = input; - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { - &self.value - } - /// Consumes the builder and constructs a [`GetTimestampOutput`](crate::operation::get_timestamp::GetTimestampOutput). - pub fn build(self) -> crate::operation::get_timestamp::GetTimestampOutput { - crate::operation::get_timestamp::GetTimestampOutput { value: self.value } +pub fn value(mut self, input: impl ::std::convert::Into<::aws_smithy_types::DateTime>) -> Self { + self.value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.value = input; + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.value +} + /// Consumes the builder and constructs a [`GetTimestampOutput`](crate::operation::operation::GetTimestampOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::get_timestamp::GetTimestampOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::get_timestamp::GetTimestampOutput { + value: self.value, + }) } } diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/builders.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/builders.rs index 6097f5dc0..4f9282db2 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/builders.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/builders.rs @@ -1,4 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. pub use crate::operation::get_timestamp::_get_timestamp_output::GetTimestampOutputBuilder; pub use crate::operation::get_timestamp::_get_timestamp_input::GetTimestampInputBuilder; @@ -22,7 +24,7 @@ impl GetTimestampInputBuilder { #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct GetTimestampFluentBuilder { client: crate::client::Client, - inner: crate::operation::get_timestamp::builders::GetTimestampInputBuilder, + pub(crate) inner: crate::operation::get_timestamp::builders::GetTimestampInputBuilder, } impl GetTimestampFluentBuilder { /// Creates a new `GetTimestamp`. @@ -56,17 +58,17 @@ impl GetTimestampFluentBuilder { } #[allow(missing_docs)] // documentation missing in model - pub fn value(mut self, input: impl ::std::convert::Into<::aws_smithy_types::DateTime>) -> Self { - self.inner = self.inner.value(input.into()); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn set_value(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { - self.inner = self.inner.set_value(input); - self - } - #[allow(missing_docs)] // documentation missing in model - pub fn get_value(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { - self.inner.get_value() - } +pub fn value(mut self, input: impl ::std::convert::Into<::aws_smithy_types::DateTime>) -> Self { + self.inner = self.inner.value(input.into()); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn set_value(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.inner = self.inner.set_value(input); + self +} +#[allow(missing_docs)] // documentation missing in model +pub fn get_value(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + self.inner.get_value() +} } diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/standard_library_conversions.rs index 3a51134c6..6bf8297d8 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/standard_library_conversions.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/standard_library_conversions.rs @@ -1,246 +1,266 @@ pub fn ostring_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, > { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) - }, - None => crate::_Wrappers_Compile::Option::None {}, + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) + }, + None => crate::_Wrappers_Compile::Option::None {}, }; - ::std::rc::Rc::new(dafny_value) + ::std::rc::Rc::new(dafny_value) } pub fn ostring_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, - >, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input.Extract(), - ), - ) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some( + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input.Extract(), + ), + ) + } else { + None + } } -pub fn obool_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn obool_to_dafny( + input: &Option, +) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn obool_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn obool_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn olong_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) +pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn olong_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(input.Extract()) - } else { - None - } +pub fn olong_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } } -pub fn blob_to_dafny( - input: &::aws_smithy_types::Blob, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) +pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) } pub fn oblob_to_dafny( - input: &Option<::aws_smithy_types::Blob>, + input: &Option<::aws_smithy_types::Blob>, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: blob_to_dafny(&b), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { + value: blob_to_dafny(&b), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn blob_from_dafny( - input: ::dafny_runtime::Sequence, -) -> ::aws_smithy_types::Blob { - - ::aws_smithy_types::Blob::new( - ::std::rc::Rc::try_unwrap(input.to_array()) - .unwrap_or_else(|rc| (*rc).clone()), - ) +pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { + ::aws_smithy_types::Blob::new( + ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), + ) } pub fn oblob_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option<::aws_smithy_types::Blob> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(blob_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(blob_from_dafny(input.Extract())) + } else { + None + } } -pub fn double_to_dafny( - input: f64, -) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( - &f64::to_be_bytes(input).to_vec(), - |x| *x) +pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( + &f64::to_be_bytes(input).to_vec(), + |x| *x, + ) } pub fn odouble_to_dafny( - input: &Option, + input: &Option, ) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: double_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: double_to_dafny(*f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } -pub fn double_from_dafny( - input: &::dafny_runtime::Sequence, -) -> f64 { - let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); - f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) +pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { + let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); + f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) } pub fn odouble_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc>>, ) -> Option { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(double_from_dafny(&input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(double_from_dafny(&input.Extract())) + } else { + None + } } pub fn timestamp_to_dafny( - input: ::aws_smithy_types::DateTime, + input: &::aws_smithy_types::DateTime, ) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&input.to_string()) + ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &input.to_string(), + ) } pub fn otimestamp_to_dafny( - input: &Option<::aws_smithy_types::DateTime>, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: timestamp_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) + input: &Option<::aws_smithy_types::DateTime>, +) -> ::std::rc::Rc< + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, +> { + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: timestamp_to_dafny(f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) } pub fn timestamp_from_dafny( - input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, ) -> ::aws_smithy_types::DateTime { - let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&input); - ::aws_smithy_types::DateTime::from_str( - &s, - aws_smithy_types::date_time::Format::DateTime, - ).unwrap() + let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input, + ); + ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) + .unwrap() } pub fn otimestamp_from_dafny( - input: ::std::rc::Rc>>, + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, ) -> Option<::aws_smithy_types::DateTime> { - if matches!(input.as_ref(), crate::_Wrappers_Compile::Option::Some { .. }) { - Some(timestamp_from_dafny(input.Extract())) - } else { - None - } + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(timestamp_from_dafny(input.Extract())) + } else { + None + } } pub fn option_from_dafny( - input: ::std::rc::Rc>, - converter: fn(&T) -> TR, + input: ::std::rc::Rc>, + converter: fn(&T) -> TR, ) -> Option { - match &*input { - crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), - crate::_Wrappers_Compile::Option::None { } => None, - } + match &*input { + crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), + crate::_Wrappers_Compile::Option::None {} => None, + } } pub fn option_to_dafny( - input: &Option, - converter: fn(&TR) -> T, + input: &Option, + converter: fn(&TR) -> T, ) -> ::std::rc::Rc> { - match input { - Some(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::Some { - value: converter(&value) - } - ), - None => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Option::None {} - ), - } + match input { + Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { + value: converter(&value), + }), + None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), + } } pub fn result_from_dafny( - input: ::std::rc::Rc>, - converter_t: fn(&T) -> TR, - converter_e: fn(&E) -> ER, + input: ::std::rc::Rc>, + converter_t: fn(&T) -> TR, + converter_e: fn(&E) -> ER, ) -> Result { - match &*input { - crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), - crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), - } + match &*input { + crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), + crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), + } } pub fn result_to_dafny( - input: &Result, - converter_t: fn(&TR) -> T, - converter_e: fn(&ER) -> E, + input: &Result, + converter_t: fn(&TR) -> T, + converter_e: fn(&ER) -> E, ) -> ::std::rc::Rc> { - match input { - Ok(value) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: converter_t(&value) - } - ), - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: converter_e(&error) - } - ), - } -} \ No newline at end of file + match input { + Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { + value: converter_t(&value), + }), + Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { + error: converter_e(&error), + }), + } +} diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/standard_library_externs.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types.rs index b22d67ccb..7eff17a00 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types.rs @@ -1,4 +1,5 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. /// Types for the `SimpleTimestampConfig` pub mod simple_timestamp_config; diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types/simple_timestamp_config.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types/simple_timestamp_config.rs index 611191c99..678b4ac55 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types/simple_timestamp_config.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types/simple_timestamp_config.rs @@ -1,5 +1,6 @@ -// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. - +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. #[derive(::std::clone::Clone, ::std::fmt::Debug)] pub struct SimpleTimestampConfig {} diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/wrapped.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/wrapped.rs new file mode 100644 index 000000000..cefeb4517 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/wrapped.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod client; + +impl crate::r#simple::types::timestamp::internaldafny::wrapped::_default { + pub fn WrappedSimpleTimestamp(config: &::std::rc::Rc< + crate::r#simple::types::timestamp::internaldafny::types::SimpleTimestampConfig, + >) -> ::std::rc::Rc, + ::std::rc::Rc + >>{ + crate::wrapped::client::Client::from_conf(config) + } +} diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/wrapped/client.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/wrapped/client.rs new file mode 100644 index 000000000..c33b27e94 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/wrapped/client.rs @@ -0,0 +1,89 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use tokio::runtime::Runtime; + +pub struct Client { + wrapped: crate::client::Client, + + /// A `current_thread` runtime for executing operations on the + /// asynchronous client in a blocking manner. + rt: Runtime +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn crate::r#simple::types::timestamp::internaldafny::types::ISimpleTypesTimestampClient); +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); +} + +impl Client { + pub fn from_conf(config: &::std::rc::Rc< + crate::r#simple::types::timestamp::internaldafny::types::SimpleTimestampConfig, + >) -> +::std::rc::Rc, + ::std::rc::Rc +>> { + let rt_result = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build(); + let rt = match rt_result { + Ok(x) => x, + Err(error) => return crate::conversions::error::to_opaque_error_result(error), + }; + let result = crate::client::Client::from_conf( + crate::conversions::simple_timestamp_config::_simple_timestamp_config::from_dafny( + config.clone(), + ), + ); + match result { + Ok(client) => { + let wrap = crate::wrapped::client::Client { + wrapped: client, + rt + }; + std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(wrap)) + } + ) + }, + Err(error) => crate::conversions::error::to_opaque_error_result(error) + } + } +} + +impl crate::r#simple::types::timestamp::internaldafny::types::ISimpleTypesTimestampClient for Client { + fn GetTimestamp( + &mut self, + input: &std::rc::Rc< + crate::r#simple::types::timestamp::internaldafny::types::GetTimestampInput, + >, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + std::rc::Rc< + crate::r#simple::types::timestamp::internaldafny::types::GetTimestampOutput, + >, + std::rc::Rc, + >, + >{ + let inner_input = + crate::conversions::get_timestamp::_get_timestamp_input::from_dafny(input.clone()); + let result = self.rt.block_on(crate::operation::get_timestamp::GetTimestamp::send(&self.wrapped, inner_input)); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::get_timestamp::to_dafny_error(error), + }, + ), + Ok(client) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::get_timestamp::_get_timestamp_output::to_dafny(client), + }, + ), + } + } +} diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/tests/simple_timestamp_test.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/tests/simple_timestamp_test.rs index b6b60a048..f45eb0c6e 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/tests/simple_timestamp_test.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/tests/simple_timestamp_test.rs @@ -28,7 +28,7 @@ async fn test_get_timestamp() { .unwrap(); let result = client().get_timestamp().value(ts).send().await.unwrap(); let value = result.value().unwrap(); - assert_eq!(value, &ts); + assert_eq!(value, ts); } pub fn client() -> Client { diff --git a/TestModels/SimpleTypes/SimpleTimestamp/src/WrappedSimpleTypesTimestampImpl.dfy b/TestModels/SimpleTypes/SimpleTimestamp/src/WrappedSimpleTypesTimestampImpl.dfy new file mode 100644 index 000000000..ce9fc36db --- /dev/null +++ b/TestModels/SimpleTypes/SimpleTimestamp/src/WrappedSimpleTypesTimestampImpl.dfy @@ -0,0 +1,10 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +include "../Model/SimpleTypesTimestampTypesWrapped.dfy" + +module {:options "--function-syntax:4"} {:extern "simple.types.timestamp.internaldafny.wrapped"} WrappedSimpleTypesTimestampService refines WrappedAbstractSimpleTypesTimestampService { + import WrappedService = SimpleTimestamp + function WrappedDefaultSimpleTimestampConfig(): SimpleTimestampConfig { + SimpleTimestampConfig + } +} diff --git a/TestModels/SimpleTypes/SimpleTimestamp/test/SimpleTimestampImplTest.dfy b/TestModels/SimpleTypes/SimpleTimestamp/test/SimpleTimestampImplTest.dfy index 7cd928417..a30f145cd 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/test/SimpleTimestampImplTest.dfy +++ b/TestModels/SimpleTypes/SimpleTimestamp/test/SimpleTimestampImplTest.dfy @@ -12,6 +12,7 @@ module SimpleTimestampImplTest { var client :- expect SimpleTimestamp.SimpleTimestamp(); TestGetTimestamp(client); + TestGetTimestampNoMs(client); } method TestGetTimestamp(client: ISimpleTypesTimestampClient) @@ -19,9 +20,26 @@ module SimpleTimestampImplTest { modifies client.Modifies ensures client.ValidState() { - var dafnyTimestamp := "2024-06-11T12:34:56"; - var ret :- expect client.GetTimestamp(SimpleTimestamp.Types.GetTimestampInput(value:= Some(dafnyTimestamp))); + var dafnyTimestamp := "2024-06-11T12:34:56.789Z"; + var ret :- expect client.GetTimestamp(SimpleTimestamp.Types.GetTimestampInput(value := Some(dafnyTimestamp))); expect ret.value == Some(dafnyTimestamp); print ret; } + + method TestGetTimestampNoMs(client: ISimpleTypesTimestampClient) + requires client.ValidState() + modifies client.Modifies + ensures client.ValidState() + { + var dafnyTimestamp := "2024-06-11T12:34:56Z"; + var ret :- expect client.GetTimestamp(SimpleTimestamp.Types.GetTimestampInput(value := Some(dafnyTimestamp))); + expect ret.value.Some?; + var retTimestamp := ret.value.value; + + // It's okay if milliseconds are serialized, so only check for prefix + expect |retTimestamp| > 0; + expect retTimestamp[|retTimestamp| - 1] == 'Z'; + expect dafnyTimestamp[|dafnyTimestamp| - 1] <= retTimestamp[|retTimestamp| - 1]; + print ret; + } } diff --git a/TestModels/SimpleTypes/SimpleTimestamp/test/WrappedSimpleTimestampTest.dfy b/TestModels/SimpleTypes/SimpleTimestamp/test/WrappedSimpleTimestampTest.dfy index 3e741368f..d51eb599b 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/test/WrappedSimpleTimestampTest.dfy +++ b/TestModels/SimpleTypes/SimpleTimestamp/test/WrappedSimpleTimestampTest.dfy @@ -11,5 +11,6 @@ module WrappedSimpleTypesTimestampTest { var client :- expect WrappedSimpleTypesTimestampService.WrappedSimpleTimestamp(); SimpleTimestampImplTest.TestGetTimestamp(client); + SimpleTimestampImplTest.TestGetTimestampNoMs(client); } } diff --git a/TestModels/Union/runtimes/rust/src/standard_library_externs.rs b/TestModels/Union/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/Union/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_action.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_action.rs index 3b4bb95a5..86959a17b 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_action.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/attribute_action.rs @@ -7,9 +7,9 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::AttributeAction, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::AttributeAction::Add => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::ADD {}, - aws_sdk_dynamodb::types::AttributeAction::Put => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::PUT {}, - aws_sdk_dynamodb::types::AttributeAction::Delete => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::DELETE {}, + aws_sdk_dynamodb::types::AttributeAction::Add => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::ADD {}, +aws_sdk_dynamodb::types::AttributeAction::Put => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::PUT {}, +aws_sdk_dynamodb::types::AttributeAction::Delete => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::DELETE {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -18,8 +18,8 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction, ) -> aws_sdk_dynamodb::types::AttributeAction { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::ADD {} => aws_sdk_dynamodb::types::AttributeAction::Add, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::PUT {} => aws_sdk_dynamodb::types::AttributeAction::Put, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::DELETE {} => aws_sdk_dynamodb::types::AttributeAction::Delete, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::ADD {} => aws_sdk_dynamodb::types::AttributeAction::Add, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::PUT {} => aws_sdk_dynamodb::types::AttributeAction::Put, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::AttributeAction::DELETE {} => aws_sdk_dynamodb::types::AttributeAction::Delete, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_error_code_enum.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_error_code_enum.rs index 93746fece..fd53a818a 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_error_code_enum.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/batch_statement_error_code_enum.rs @@ -7,17 +7,17 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ConditionalCheckFailed => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ConditionalCheckFailed {}, - aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ItemCollectionSizeLimitExceeded => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ItemCollectionSizeLimitExceeded {}, - aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::RequestLimitExceeded => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::RequestLimitExceeded {}, - aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ValidationError => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ValidationError {}, - aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ProvisionedThroughputExceeded => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ProvisionedThroughputExceeded {}, - aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::TransactionConflict => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::TransactionConflict {}, - aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ThrottlingError => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ThrottlingError {}, - aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::InternalServerError => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::InternalServerError {}, - aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ResourceNotFound => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ResourceNotFound {}, - aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::AccessDenied => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::AccessDenied {}, - aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::DuplicateItem => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::DuplicateItem {}, + aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ConditionalCheckFailed => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ConditionalCheckFailed {}, +aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ItemCollectionSizeLimitExceeded => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ItemCollectionSizeLimitExceeded {}, +aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::RequestLimitExceeded => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::RequestLimitExceeded {}, +aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ValidationError => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ValidationError {}, +aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ProvisionedThroughputExceeded => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ProvisionedThroughputExceeded {}, +aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::TransactionConflict => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::TransactionConflict {}, +aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ThrottlingError => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ThrottlingError {}, +aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::InternalServerError => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::InternalServerError {}, +aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ResourceNotFound => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ResourceNotFound {}, +aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::AccessDenied => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::AccessDenied {}, +aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::DuplicateItem => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::DuplicateItem {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -26,16 +26,16 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum, ) -> aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ConditionalCheckFailed {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ConditionalCheckFailed, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ItemCollectionSizeLimitExceeded {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ItemCollectionSizeLimitExceeded, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::RequestLimitExceeded {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::RequestLimitExceeded, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ValidationError {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ValidationError, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ProvisionedThroughputExceeded {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ProvisionedThroughputExceeded, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::TransactionConflict {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::TransactionConflict, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ThrottlingError {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ThrottlingError, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::InternalServerError {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::InternalServerError, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ResourceNotFound {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ResourceNotFound, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::AccessDenied {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::AccessDenied, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::DuplicateItem {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::DuplicateItem, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ConditionalCheckFailed {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ConditionalCheckFailed, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ItemCollectionSizeLimitExceeded {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ItemCollectionSizeLimitExceeded, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::RequestLimitExceeded {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::RequestLimitExceeded, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ValidationError {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ValidationError, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ProvisionedThroughputExceeded {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ProvisionedThroughputExceeded, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::TransactionConflict {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::TransactionConflict, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ThrottlingError {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ThrottlingError, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::InternalServerError {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::InternalServerError, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::ResourceNotFound {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::ResourceNotFound, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::AccessDenied {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::AccessDenied, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BatchStatementErrorCodeEnum::DuplicateItem {} => aws_sdk_dynamodb::types::BatchStatementErrorCodeEnum::DuplicateItem, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/billing_mode.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/billing_mode.rs index 5304c2abc..a29d5b356 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/billing_mode.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/billing_mode.rs @@ -7,8 +7,8 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::BillingMode, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::BillingMode::Provisioned => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode::PROVISIONED {}, - aws_sdk_dynamodb::types::BillingMode::PayPerRequest => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode::PAY_PER_REQUEST {}, + aws_sdk_dynamodb::types::BillingMode::Provisioned => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode::PROVISIONED {}, +aws_sdk_dynamodb::types::BillingMode::PayPerRequest => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode::PAY_PER_REQUEST {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -17,7 +17,7 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode, ) -> aws_sdk_dynamodb::types::BillingMode { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode::PROVISIONED {} => aws_sdk_dynamodb::types::BillingMode::Provisioned, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode::PAY_PER_REQUEST {} => aws_sdk_dynamodb::types::BillingMode::PayPerRequest, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode::PROVISIONED {} => aws_sdk_dynamodb::types::BillingMode::Provisioned, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::BillingMode::PAY_PER_REQUEST {} => aws_sdk_dynamodb::types::BillingMode::PayPerRequest, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/comparison_operator.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/comparison_operator.rs index 0c75159bd..a18dec568 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/comparison_operator.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/comparison_operator.rs @@ -7,19 +7,19 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::ComparisonOperator, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ComparisonOperator::Eq => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::EQ {}, - aws_sdk_dynamodb::types::ComparisonOperator::Ne => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NE {}, - aws_sdk_dynamodb::types::ComparisonOperator::In => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::IN {}, - aws_sdk_dynamodb::types::ComparisonOperator::Le => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::LE {}, - aws_sdk_dynamodb::types::ComparisonOperator::Lt => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::LT {}, - aws_sdk_dynamodb::types::ComparisonOperator::Ge => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::GE {}, - aws_sdk_dynamodb::types::ComparisonOperator::Gt => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::GT {}, - aws_sdk_dynamodb::types::ComparisonOperator::Between => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::BETWEEN {}, - aws_sdk_dynamodb::types::ComparisonOperator::NotNull => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NOT_NULL {}, - aws_sdk_dynamodb::types::ComparisonOperator::Null => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NULL {}, - aws_sdk_dynamodb::types::ComparisonOperator::Contains => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::CONTAINS {}, - aws_sdk_dynamodb::types::ComparisonOperator::NotContains => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NOT_CONTAINS {}, - aws_sdk_dynamodb::types::ComparisonOperator::BeginsWith => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::BEGINS_WITH {}, + aws_sdk_dynamodb::types::ComparisonOperator::Eq => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::EQ {}, +aws_sdk_dynamodb::types::ComparisonOperator::Ne => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NE {}, +aws_sdk_dynamodb::types::ComparisonOperator::In => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::IN {}, +aws_sdk_dynamodb::types::ComparisonOperator::Le => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::LE {}, +aws_sdk_dynamodb::types::ComparisonOperator::Lt => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::LT {}, +aws_sdk_dynamodb::types::ComparisonOperator::Ge => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::GE {}, +aws_sdk_dynamodb::types::ComparisonOperator::Gt => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::GT {}, +aws_sdk_dynamodb::types::ComparisonOperator::Between => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::BETWEEN {}, +aws_sdk_dynamodb::types::ComparisonOperator::NotNull => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NOT_NULL {}, +aws_sdk_dynamodb::types::ComparisonOperator::Null => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NULL {}, +aws_sdk_dynamodb::types::ComparisonOperator::Contains => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::CONTAINS {}, +aws_sdk_dynamodb::types::ComparisonOperator::NotContains => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NOT_CONTAINS {}, +aws_sdk_dynamodb::types::ComparisonOperator::BeginsWith => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::BEGINS_WITH {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -28,18 +28,18 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator, ) -> aws_sdk_dynamodb::types::ComparisonOperator { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::EQ {} => aws_sdk_dynamodb::types::ComparisonOperator::Eq, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NE {} => aws_sdk_dynamodb::types::ComparisonOperator::Ne, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::IN {} => aws_sdk_dynamodb::types::ComparisonOperator::In, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::LE {} => aws_sdk_dynamodb::types::ComparisonOperator::Le, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::LT {} => aws_sdk_dynamodb::types::ComparisonOperator::Lt, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::GE {} => aws_sdk_dynamodb::types::ComparisonOperator::Ge, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::GT {} => aws_sdk_dynamodb::types::ComparisonOperator::Gt, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::BETWEEN {} => aws_sdk_dynamodb::types::ComparisonOperator::Between, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NOT_NULL {} => aws_sdk_dynamodb::types::ComparisonOperator::NotNull, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NULL {} => aws_sdk_dynamodb::types::ComparisonOperator::Null, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::CONTAINS {} => aws_sdk_dynamodb::types::ComparisonOperator::Contains, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NOT_CONTAINS {} => aws_sdk_dynamodb::types::ComparisonOperator::NotContains, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::BEGINS_WITH {} => aws_sdk_dynamodb::types::ComparisonOperator::BeginsWith, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::EQ {} => aws_sdk_dynamodb::types::ComparisonOperator::Eq, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NE {} => aws_sdk_dynamodb::types::ComparisonOperator::Ne, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::IN {} => aws_sdk_dynamodb::types::ComparisonOperator::In, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::LE {} => aws_sdk_dynamodb::types::ComparisonOperator::Le, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::LT {} => aws_sdk_dynamodb::types::ComparisonOperator::Lt, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::GE {} => aws_sdk_dynamodb::types::ComparisonOperator::Ge, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::GT {} => aws_sdk_dynamodb::types::ComparisonOperator::Gt, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::BETWEEN {} => aws_sdk_dynamodb::types::ComparisonOperator::Between, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NOT_NULL {} => aws_sdk_dynamodb::types::ComparisonOperator::NotNull, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NULL {} => aws_sdk_dynamodb::types::ComparisonOperator::Null, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::CONTAINS {} => aws_sdk_dynamodb::types::ComparisonOperator::Contains, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::NOT_CONTAINS {} => aws_sdk_dynamodb::types::ComparisonOperator::NotContains, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ComparisonOperator::BEGINS_WITH {} => aws_sdk_dynamodb::types::ComparisonOperator::BeginsWith, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/conditional_operator.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/conditional_operator.rs index 64208da48..216ac006f 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/conditional_operator.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/conditional_operator.rs @@ -7,8 +7,8 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::ConditionalOperator, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ConditionalOperator::And => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator::AND {}, - aws_sdk_dynamodb::types::ConditionalOperator::Or => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator::OR {}, + aws_sdk_dynamodb::types::ConditionalOperator::And => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator::AND {}, +aws_sdk_dynamodb::types::ConditionalOperator::Or => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator::OR {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -17,7 +17,7 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator, ) -> aws_sdk_dynamodb::types::ConditionalOperator { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator::AND {} => aws_sdk_dynamodb::types::ConditionalOperator::And, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator::OR {} => aws_sdk_dynamodb::types::ConditionalOperator::Or, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator::AND {} => aws_sdk_dynamodb::types::ConditionalOperator::And, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ConditionalOperator::OR {} => aws_sdk_dynamodb::types::ConditionalOperator::Or, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/index_status.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/index_status.rs index cd99dab3d..df88cdcb2 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/index_status.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/index_status.rs @@ -7,10 +7,10 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::IndexStatus, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::IndexStatus::Creating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::CREATING {}, - aws_sdk_dynamodb::types::IndexStatus::Updating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::UPDATING {}, - aws_sdk_dynamodb::types::IndexStatus::Deleting => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::DELETING {}, - aws_sdk_dynamodb::types::IndexStatus::Active => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::ACTIVE {}, + aws_sdk_dynamodb::types::IndexStatus::Creating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::CREATING {}, +aws_sdk_dynamodb::types::IndexStatus::Updating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::UPDATING {}, +aws_sdk_dynamodb::types::IndexStatus::Deleting => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::DELETING {}, +aws_sdk_dynamodb::types::IndexStatus::Active => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::ACTIVE {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -19,9 +19,9 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus, ) -> aws_sdk_dynamodb::types::IndexStatus { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::CREATING {} => aws_sdk_dynamodb::types::IndexStatus::Creating, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::UPDATING {} => aws_sdk_dynamodb::types::IndexStatus::Updating, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::DELETING {} => aws_sdk_dynamodb::types::IndexStatus::Deleting, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::ACTIVE {} => aws_sdk_dynamodb::types::IndexStatus::Active, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::CREATING {} => aws_sdk_dynamodb::types::IndexStatus::Creating, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::UPDATING {} => aws_sdk_dynamodb::types::IndexStatus::Updating, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::DELETING {} => aws_sdk_dynamodb::types::IndexStatus::Deleting, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::IndexStatus::ACTIVE {} => aws_sdk_dynamodb::types::IndexStatus::Active, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/key_type.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/key_type.rs index 0d5d59c56..ea86df5b0 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/key_type.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/key_type.rs @@ -7,8 +7,8 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::KeyType, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::KeyType::Hash => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType::HASH {}, - aws_sdk_dynamodb::types::KeyType::Range => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType::RANGE {}, + aws_sdk_dynamodb::types::KeyType::Hash => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType::HASH {}, +aws_sdk_dynamodb::types::KeyType::Range => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType::RANGE {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -17,7 +17,7 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType, ) -> aws_sdk_dynamodb::types::KeyType { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType::HASH {} => aws_sdk_dynamodb::types::KeyType::Hash, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType::RANGE {} => aws_sdk_dynamodb::types::KeyType::Range, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType::HASH {} => aws_sdk_dynamodb::types::KeyType::Hash, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::KeyType::RANGE {} => aws_sdk_dynamodb::types::KeyType::Range, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/projection_type.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/projection_type.rs index d242c07d4..28b89124f 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/projection_type.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/projection_type.rs @@ -7,9 +7,9 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::ProjectionType, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ProjectionType::All => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::ALL {}, - aws_sdk_dynamodb::types::ProjectionType::KeysOnly => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::KEYS_ONLY {}, - aws_sdk_dynamodb::types::ProjectionType::Include => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::INCLUDE {}, + aws_sdk_dynamodb::types::ProjectionType::All => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::ALL {}, +aws_sdk_dynamodb::types::ProjectionType::KeysOnly => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::KEYS_ONLY {}, +aws_sdk_dynamodb::types::ProjectionType::Include => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::INCLUDE {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -18,8 +18,8 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType, ) -> aws_sdk_dynamodb::types::ProjectionType { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::ALL {} => aws_sdk_dynamodb::types::ProjectionType::All, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::KEYS_ONLY {} => aws_sdk_dynamodb::types::ProjectionType::KeysOnly, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::INCLUDE {} => aws_sdk_dynamodb::types::ProjectionType::Include, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::ALL {} => aws_sdk_dynamodb::types::ProjectionType::All, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::KEYS_ONLY {} => aws_sdk_dynamodb::types::ProjectionType::KeysOnly, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ProjectionType::INCLUDE {} => aws_sdk_dynamodb::types::ProjectionType::Include, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_status.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_status.rs index 11e2638d4..fd626473a 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_status.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/replica_status.rs @@ -7,13 +7,13 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::ReplicaStatus, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ReplicaStatus::Creating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::CREATING {}, - aws_sdk_dynamodb::types::ReplicaStatus::CreationFailed => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::CREATION_FAILED {}, - aws_sdk_dynamodb::types::ReplicaStatus::Updating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::UPDATING {}, - aws_sdk_dynamodb::types::ReplicaStatus::Deleting => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::DELETING {}, - aws_sdk_dynamodb::types::ReplicaStatus::Active => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::ACTIVE {}, - aws_sdk_dynamodb::types::ReplicaStatus::RegionDisabled => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::REGION_DISABLED {}, - aws_sdk_dynamodb::types::ReplicaStatus::InaccessibleEncryptionCredentials => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::INACCESSIBLE_ENCRYPTION_CREDENTIALS {}, + aws_sdk_dynamodb::types::ReplicaStatus::Creating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::CREATING {}, +aws_sdk_dynamodb::types::ReplicaStatus::CreationFailed => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::CREATION_FAILED {}, +aws_sdk_dynamodb::types::ReplicaStatus::Updating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::UPDATING {}, +aws_sdk_dynamodb::types::ReplicaStatus::Deleting => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::DELETING {}, +aws_sdk_dynamodb::types::ReplicaStatus::Active => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::ACTIVE {}, +aws_sdk_dynamodb::types::ReplicaStatus::RegionDisabled => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::REGION_DISABLED {}, +aws_sdk_dynamodb::types::ReplicaStatus::InaccessibleEncryptionCredentials => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::INACCESSIBLE_ENCRYPTION_CREDENTIALS {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -22,12 +22,12 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus, ) -> aws_sdk_dynamodb::types::ReplicaStatus { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::CREATING {} => aws_sdk_dynamodb::types::ReplicaStatus::Creating, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::CREATION_FAILED {} => aws_sdk_dynamodb::types::ReplicaStatus::CreationFailed, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::UPDATING {} => aws_sdk_dynamodb::types::ReplicaStatus::Updating, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::DELETING {} => aws_sdk_dynamodb::types::ReplicaStatus::Deleting, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::ACTIVE {} => aws_sdk_dynamodb::types::ReplicaStatus::Active, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::REGION_DISABLED {} => aws_sdk_dynamodb::types::ReplicaStatus::RegionDisabled, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::INACCESSIBLE_ENCRYPTION_CREDENTIALS {} => aws_sdk_dynamodb::types::ReplicaStatus::InaccessibleEncryptionCredentials, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::CREATING {} => aws_sdk_dynamodb::types::ReplicaStatus::Creating, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::CREATION_FAILED {} => aws_sdk_dynamodb::types::ReplicaStatus::CreationFailed, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::UPDATING {} => aws_sdk_dynamodb::types::ReplicaStatus::Updating, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::DELETING {} => aws_sdk_dynamodb::types::ReplicaStatus::Deleting, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::ACTIVE {} => aws_sdk_dynamodb::types::ReplicaStatus::Active, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::REGION_DISABLED {} => aws_sdk_dynamodb::types::ReplicaStatus::RegionDisabled, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReplicaStatus::INACCESSIBLE_ENCRYPTION_CREDENTIALS {} => aws_sdk_dynamodb::types::ReplicaStatus::InaccessibleEncryptionCredentials, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_consumed_capacity.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_consumed_capacity.rs index fbfeeb4e6..b2526611f 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_consumed_capacity.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_consumed_capacity.rs @@ -7,9 +7,9 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::ReturnConsumedCapacity, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ReturnConsumedCapacity::Indexes => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::INDEXES {}, - aws_sdk_dynamodb::types::ReturnConsumedCapacity::Total => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::TOTAL {}, - aws_sdk_dynamodb::types::ReturnConsumedCapacity::None => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::NONE {}, + aws_sdk_dynamodb::types::ReturnConsumedCapacity::Indexes => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::INDEXES {}, +aws_sdk_dynamodb::types::ReturnConsumedCapacity::Total => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::TOTAL {}, +aws_sdk_dynamodb::types::ReturnConsumedCapacity::None => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::NONE {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -18,8 +18,8 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity, ) -> aws_sdk_dynamodb::types::ReturnConsumedCapacity { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::INDEXES {} => aws_sdk_dynamodb::types::ReturnConsumedCapacity::Indexes, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::TOTAL {} => aws_sdk_dynamodb::types::ReturnConsumedCapacity::Total, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::NONE {} => aws_sdk_dynamodb::types::ReturnConsumedCapacity::None, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::INDEXES {} => aws_sdk_dynamodb::types::ReturnConsumedCapacity::Indexes, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::TOTAL {} => aws_sdk_dynamodb::types::ReturnConsumedCapacity::Total, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnConsumedCapacity::NONE {} => aws_sdk_dynamodb::types::ReturnConsumedCapacity::None, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_item_collection_metrics.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_item_collection_metrics.rs index 0896dc4cd..685738730 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_item_collection_metrics.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_item_collection_metrics.rs @@ -7,8 +7,8 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::ReturnItemCollectionMetrics, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ReturnItemCollectionMetrics::Size => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics::SIZE {}, - aws_sdk_dynamodb::types::ReturnItemCollectionMetrics::None => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics::NONE {}, + aws_sdk_dynamodb::types::ReturnItemCollectionMetrics::Size => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics::SIZE {}, +aws_sdk_dynamodb::types::ReturnItemCollectionMetrics::None => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics::NONE {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -17,7 +17,7 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics, ) -> aws_sdk_dynamodb::types::ReturnItemCollectionMetrics { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics::SIZE {} => aws_sdk_dynamodb::types::ReturnItemCollectionMetrics::Size, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics::NONE {} => aws_sdk_dynamodb::types::ReturnItemCollectionMetrics::None, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics::SIZE {} => aws_sdk_dynamodb::types::ReturnItemCollectionMetrics::Size, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnItemCollectionMetrics::NONE {} => aws_sdk_dynamodb::types::ReturnItemCollectionMetrics::None, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_value.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_value.rs index 21983ab80..df8085df3 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_value.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_value.rs @@ -7,11 +7,11 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::ReturnValue, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ReturnValue::None => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::NONE {}, - aws_sdk_dynamodb::types::ReturnValue::AllOld => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::ALL_OLD {}, - aws_sdk_dynamodb::types::ReturnValue::UpdatedOld => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::UPDATED_OLD {}, - aws_sdk_dynamodb::types::ReturnValue::AllNew => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::ALL_NEW {}, - aws_sdk_dynamodb::types::ReturnValue::UpdatedNew => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::UPDATED_NEW {}, + aws_sdk_dynamodb::types::ReturnValue::None => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::NONE {}, +aws_sdk_dynamodb::types::ReturnValue::AllOld => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::ALL_OLD {}, +aws_sdk_dynamodb::types::ReturnValue::UpdatedOld => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::UPDATED_OLD {}, +aws_sdk_dynamodb::types::ReturnValue::AllNew => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::ALL_NEW {}, +aws_sdk_dynamodb::types::ReturnValue::UpdatedNew => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::UPDATED_NEW {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -20,10 +20,10 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue, ) -> aws_sdk_dynamodb::types::ReturnValue { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::NONE {} => aws_sdk_dynamodb::types::ReturnValue::None, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::ALL_OLD {} => aws_sdk_dynamodb::types::ReturnValue::AllOld, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::UPDATED_OLD {} => aws_sdk_dynamodb::types::ReturnValue::UpdatedOld, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::ALL_NEW {} => aws_sdk_dynamodb::types::ReturnValue::AllNew, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::UPDATED_NEW {} => aws_sdk_dynamodb::types::ReturnValue::UpdatedNew, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::NONE {} => aws_sdk_dynamodb::types::ReturnValue::None, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::ALL_OLD {} => aws_sdk_dynamodb::types::ReturnValue::AllOld, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::UPDATED_OLD {} => aws_sdk_dynamodb::types::ReturnValue::UpdatedOld, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::ALL_NEW {} => aws_sdk_dynamodb::types::ReturnValue::AllNew, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValue::UPDATED_NEW {} => aws_sdk_dynamodb::types::ReturnValue::UpdatedNew, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_values_on_condition_check_failure.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_values_on_condition_check_failure.rs index b18546232..7d3380d94 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_values_on_condition_check_failure.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/return_values_on_condition_check_failure.rs @@ -7,8 +7,8 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure::AllOld => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure::ALL_OLD {}, - aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure::None => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure::NONE {}, + aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure::AllOld => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure::ALL_OLD {}, +aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure::None => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure::NONE {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -17,7 +17,7 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure, ) -> aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure::ALL_OLD {} => aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure::AllOld, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure::NONE {} => aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure::None, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure::ALL_OLD {} => aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure::AllOld, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ReturnValuesOnConditionCheckFailure::NONE {} => aws_sdk_dynamodb::types::ReturnValuesOnConditionCheckFailure::None, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scalar_attribute_type.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scalar_attribute_type.rs index 7a16ac815..f921f603f 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scalar_attribute_type.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/scalar_attribute_type.rs @@ -7,9 +7,9 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::ScalarAttributeType, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::ScalarAttributeType::S => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::S {}, - aws_sdk_dynamodb::types::ScalarAttributeType::N => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::N {}, - aws_sdk_dynamodb::types::ScalarAttributeType::B => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::B {}, + aws_sdk_dynamodb::types::ScalarAttributeType::S => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::S {}, +aws_sdk_dynamodb::types::ScalarAttributeType::N => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::N {}, +aws_sdk_dynamodb::types::ScalarAttributeType::B => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::B {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -18,8 +18,8 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType, ) -> aws_sdk_dynamodb::types::ScalarAttributeType { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::S {} => aws_sdk_dynamodb::types::ScalarAttributeType::S, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::N {} => aws_sdk_dynamodb::types::ScalarAttributeType::N, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::B {} => aws_sdk_dynamodb::types::ScalarAttributeType::B, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::S {} => aws_sdk_dynamodb::types::ScalarAttributeType::S, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::N {} => aws_sdk_dynamodb::types::ScalarAttributeType::N, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::ScalarAttributeType::B {} => aws_sdk_dynamodb::types::ScalarAttributeType::B, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/select.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/select.rs index 52afedb1c..c52b7a634 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/select.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/select.rs @@ -7,10 +7,10 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::Select, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::Select::AllAttributes => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::ALL_ATTRIBUTES {}, - aws_sdk_dynamodb::types::Select::AllProjectedAttributes => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::ALL_PROJECTED_ATTRIBUTES {}, - aws_sdk_dynamodb::types::Select::SpecificAttributes => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::SPECIFIC_ATTRIBUTES {}, - aws_sdk_dynamodb::types::Select::Count => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::COUNT {}, + aws_sdk_dynamodb::types::Select::AllAttributes => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::ALL_ATTRIBUTES {}, +aws_sdk_dynamodb::types::Select::AllProjectedAttributes => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::ALL_PROJECTED_ATTRIBUTES {}, +aws_sdk_dynamodb::types::Select::SpecificAttributes => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::SPECIFIC_ATTRIBUTES {}, +aws_sdk_dynamodb::types::Select::Count => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::COUNT {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -19,9 +19,9 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select, ) -> aws_sdk_dynamodb::types::Select { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::ALL_ATTRIBUTES {} => aws_sdk_dynamodb::types::Select::AllAttributes, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::ALL_PROJECTED_ATTRIBUTES {} => aws_sdk_dynamodb::types::Select::AllProjectedAttributes, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::SPECIFIC_ATTRIBUTES {} => aws_sdk_dynamodb::types::Select::SpecificAttributes, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::COUNT {} => aws_sdk_dynamodb::types::Select::Count, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::ALL_ATTRIBUTES {} => aws_sdk_dynamodb::types::Select::AllAttributes, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::ALL_PROJECTED_ATTRIBUTES {} => aws_sdk_dynamodb::types::Select::AllProjectedAttributes, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::SPECIFIC_ATTRIBUTES {} => aws_sdk_dynamodb::types::Select::SpecificAttributes, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::Select::COUNT {} => aws_sdk_dynamodb::types::Select::Count, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_status.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_status.rs index fd0a2e7a4..a4f20bf1c 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_status.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_status.rs @@ -7,11 +7,11 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::SseStatus, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::SseStatus::Enabling => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::ENABLING {}, - aws_sdk_dynamodb::types::SseStatus::Enabled => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::ENABLED {}, - aws_sdk_dynamodb::types::SseStatus::Disabling => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::DISABLING {}, - aws_sdk_dynamodb::types::SseStatus::Disabled => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::DISABLED {}, - aws_sdk_dynamodb::types::SseStatus::Updating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::UPDATING {}, + aws_sdk_dynamodb::types::SseStatus::Enabling => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::ENABLING {}, +aws_sdk_dynamodb::types::SseStatus::Enabled => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::ENABLED {}, +aws_sdk_dynamodb::types::SseStatus::Disabling => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::DISABLING {}, +aws_sdk_dynamodb::types::SseStatus::Disabled => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::DISABLED {}, +aws_sdk_dynamodb::types::SseStatus::Updating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::UPDATING {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -20,10 +20,10 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus, ) -> aws_sdk_dynamodb::types::SseStatus { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::ENABLING {} => aws_sdk_dynamodb::types::SseStatus::Enabling, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::ENABLED {} => aws_sdk_dynamodb::types::SseStatus::Enabled, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::DISABLING {} => aws_sdk_dynamodb::types::SseStatus::Disabling, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::DISABLED {} => aws_sdk_dynamodb::types::SseStatus::Disabled, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::UPDATING {} => aws_sdk_dynamodb::types::SseStatus::Updating, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::ENABLING {} => aws_sdk_dynamodb::types::SseStatus::Enabling, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::ENABLED {} => aws_sdk_dynamodb::types::SseStatus::Enabled, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::DISABLING {} => aws_sdk_dynamodb::types::SseStatus::Disabling, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::DISABLED {} => aws_sdk_dynamodb::types::SseStatus::Disabled, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEStatus::UPDATING {} => aws_sdk_dynamodb::types::SseStatus::Updating, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_type.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_type.rs index 6a6dfd122..56f69062b 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_type.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/sse_type.rs @@ -7,8 +7,8 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::SseType, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::SseType::Aes256 => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType::AES256 {}, - aws_sdk_dynamodb::types::SseType::Kms => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType::KMS {}, + aws_sdk_dynamodb::types::SseType::Aes256 => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType::AES256 {}, +aws_sdk_dynamodb::types::SseType::Kms => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType::KMS {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -17,7 +17,7 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType, ) -> aws_sdk_dynamodb::types::SseType { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType::AES256 {} => aws_sdk_dynamodb::types::SseType::Aes256, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType::KMS {} => aws_sdk_dynamodb::types::SseType::Kms, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType::AES256 {} => aws_sdk_dynamodb::types::SseType::Aes256, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::SSEType::KMS {} => aws_sdk_dynamodb::types::SseType::Kms, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/stream_view_type.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/stream_view_type.rs index df3a0c2b7..718b38e76 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/stream_view_type.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/stream_view_type.rs @@ -7,10 +7,10 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::StreamViewType, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::StreamViewType::NewImage => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::NEW_IMAGE {}, - aws_sdk_dynamodb::types::StreamViewType::OldImage => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::OLD_IMAGE {}, - aws_sdk_dynamodb::types::StreamViewType::NewAndOldImages => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::NEW_AND_OLD_IMAGES {}, - aws_sdk_dynamodb::types::StreamViewType::KeysOnly => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::KEYS_ONLY {}, + aws_sdk_dynamodb::types::StreamViewType::NewImage => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::NEW_IMAGE {}, +aws_sdk_dynamodb::types::StreamViewType::OldImage => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::OLD_IMAGE {}, +aws_sdk_dynamodb::types::StreamViewType::NewAndOldImages => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::NEW_AND_OLD_IMAGES {}, +aws_sdk_dynamodb::types::StreamViewType::KeysOnly => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::KEYS_ONLY {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -19,9 +19,9 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType, ) -> aws_sdk_dynamodb::types::StreamViewType { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::NEW_IMAGE {} => aws_sdk_dynamodb::types::StreamViewType::NewImage, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::OLD_IMAGE {} => aws_sdk_dynamodb::types::StreamViewType::OldImage, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::NEW_AND_OLD_IMAGES {} => aws_sdk_dynamodb::types::StreamViewType::NewAndOldImages, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::KEYS_ONLY {} => aws_sdk_dynamodb::types::StreamViewType::KeysOnly, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::NEW_IMAGE {} => aws_sdk_dynamodb::types::StreamViewType::NewImage, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::OLD_IMAGE {} => aws_sdk_dynamodb::types::StreamViewType::OldImage, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::NEW_AND_OLD_IMAGES {} => aws_sdk_dynamodb::types::StreamViewType::NewAndOldImages, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::StreamViewType::KEYS_ONLY {} => aws_sdk_dynamodb::types::StreamViewType::KeysOnly, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_class.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_class.rs index dba3a71da..f0a717fc9 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_class.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_class.rs @@ -7,8 +7,8 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::TableClass, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::TableClass::Standard => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass::STANDARD {}, - aws_sdk_dynamodb::types::TableClass::StandardInfrequentAccess => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass::STANDARD_INFREQUENT_ACCESS {}, + aws_sdk_dynamodb::types::TableClass::Standard => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass::STANDARD {}, +aws_sdk_dynamodb::types::TableClass::StandardInfrequentAccess => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass::STANDARD_INFREQUENT_ACCESS {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -17,7 +17,7 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass, ) -> aws_sdk_dynamodb::types::TableClass { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass::STANDARD {} => aws_sdk_dynamodb::types::TableClass::Standard, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass::STANDARD_INFREQUENT_ACCESS {} => aws_sdk_dynamodb::types::TableClass::StandardInfrequentAccess, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass::STANDARD {} => aws_sdk_dynamodb::types::TableClass::Standard, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableClass::STANDARD_INFREQUENT_ACCESS {} => aws_sdk_dynamodb::types::TableClass::StandardInfrequentAccess, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_status.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_status.rs index 444e0c541..e996bc880 100644 --- a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_status.rs +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/conversions/table_status.rs @@ -7,13 +7,13 @@ pub fn to_dafny( value: aws_sdk_dynamodb::types::TableStatus, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_dynamodb::types::TableStatus::Creating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::CREATING {}, - aws_sdk_dynamodb::types::TableStatus::Updating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::UPDATING {}, - aws_sdk_dynamodb::types::TableStatus::Deleting => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::DELETING {}, - aws_sdk_dynamodb::types::TableStatus::Active => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ACTIVE {}, - aws_sdk_dynamodb::types::TableStatus::InaccessibleEncryptionCredentials => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::INACCESSIBLE_ENCRYPTION_CREDENTIALS {}, - aws_sdk_dynamodb::types::TableStatus::Archiving => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ARCHIVING {}, - aws_sdk_dynamodb::types::TableStatus::Archived => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ARCHIVED {}, + aws_sdk_dynamodb::types::TableStatus::Creating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::CREATING {}, +aws_sdk_dynamodb::types::TableStatus::Updating => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::UPDATING {}, +aws_sdk_dynamodb::types::TableStatus::Deleting => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::DELETING {}, +aws_sdk_dynamodb::types::TableStatus::Active => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ACTIVE {}, +aws_sdk_dynamodb::types::TableStatus::InaccessibleEncryptionCredentials => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::INACCESSIBLE_ENCRYPTION_CREDENTIALS {}, +aws_sdk_dynamodb::types::TableStatus::Archiving => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ARCHIVING {}, +aws_sdk_dynamodb::types::TableStatus::Archived => crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ARCHIVED {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -22,12 +22,12 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus, ) -> aws_sdk_dynamodb::types::TableStatus { match dafny_value { - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::CREATING {} => aws_sdk_dynamodb::types::TableStatus::Creating, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::UPDATING {} => aws_sdk_dynamodb::types::TableStatus::Updating, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::DELETING {} => aws_sdk_dynamodb::types::TableStatus::Deleting, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ACTIVE {} => aws_sdk_dynamodb::types::TableStatus::Active, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::INACCESSIBLE_ENCRYPTION_CREDENTIALS {} => aws_sdk_dynamodb::types::TableStatus::InaccessibleEncryptionCredentials, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ARCHIVING {} => aws_sdk_dynamodb::types::TableStatus::Archiving, - crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ARCHIVED {} => aws_sdk_dynamodb::types::TableStatus::Archived, + crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::CREATING {} => aws_sdk_dynamodb::types::TableStatus::Creating, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::UPDATING {} => aws_sdk_dynamodb::types::TableStatus::Updating, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::DELETING {} => aws_sdk_dynamodb::types::TableStatus::Deleting, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ACTIVE {} => aws_sdk_dynamodb::types::TableStatus::Active, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::INACCESSIBLE_ENCRYPTION_CREDENTIALS {} => aws_sdk_dynamodb::types::TableStatus::InaccessibleEncryptionCredentials, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ARCHIVING {} => aws_sdk_dynamodb::types::TableStatus::Archiving, +crate::r#software::amazon::cryptography::services::dynamodb::internaldafny::types::TableStatus::ARCHIVED {} => aws_sdk_dynamodb::types::TableStatus::Archived, } } diff --git a/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/standard_library_externs.rs b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/aws-sdks/ddb-lite/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/customer_master_key_spec.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/customer_master_key_spec.rs index 3115f64a3..d00e07390 100644 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/customer_master_key_spec.rs +++ b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/customer_master_key_spec.rs @@ -7,19 +7,19 @@ pub fn to_dafny( value: aws_sdk_kms::types::CustomerMasterKeySpec, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_kms::types::CustomerMasterKeySpec::Rsa2048 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_2048 {}, - aws_sdk_kms::types::CustomerMasterKeySpec::Rsa3072 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_3072 {}, - aws_sdk_kms::types::CustomerMasterKeySpec::Rsa4096 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_4096 {}, - aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P256 {}, - aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P384 {}, - aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP521 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P521 {}, - aws_sdk_kms::types::CustomerMasterKeySpec::EccSecgP256K1 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_SECG_P256K1 {}, - aws_sdk_kms::types::CustomerMasterKeySpec::SymmetricDefault => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::SYMMETRIC_DEFAULT {}, - aws_sdk_kms::types::CustomerMasterKeySpec::Hmac224 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_224 {}, - aws_sdk_kms::types::CustomerMasterKeySpec::Hmac256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_256 {}, - aws_sdk_kms::types::CustomerMasterKeySpec::Hmac384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_384 {}, - aws_sdk_kms::types::CustomerMasterKeySpec::Hmac512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_512 {}, - aws_sdk_kms::types::CustomerMasterKeySpec::Sm2 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::SM2 {}, + aws_sdk_kms::types::CustomerMasterKeySpec::Rsa2048 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_2048 {}, +aws_sdk_kms::types::CustomerMasterKeySpec::Rsa3072 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_3072 {}, +aws_sdk_kms::types::CustomerMasterKeySpec::Rsa4096 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_4096 {}, +aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P256 {}, +aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P384 {}, +aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP521 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P521 {}, +aws_sdk_kms::types::CustomerMasterKeySpec::EccSecgP256K1 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_SECG_P256K1 {}, +aws_sdk_kms::types::CustomerMasterKeySpec::SymmetricDefault => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::SYMMETRIC_DEFAULT {}, +aws_sdk_kms::types::CustomerMasterKeySpec::Hmac224 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_224 {}, +aws_sdk_kms::types::CustomerMasterKeySpec::Hmac256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_256 {}, +aws_sdk_kms::types::CustomerMasterKeySpec::Hmac384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_384 {}, +aws_sdk_kms::types::CustomerMasterKeySpec::Hmac512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_512 {}, +aws_sdk_kms::types::CustomerMasterKeySpec::Sm2 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::SM2 {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -28,18 +28,18 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec, ) -> aws_sdk_kms::types::CustomerMasterKeySpec { match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_2048 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Rsa2048, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_3072 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Rsa3072, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_4096 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Rsa4096, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P256 {} => aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP256, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P384 {} => aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP384, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P521 {} => aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP521, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_SECG_P256K1 {} => aws_sdk_kms::types::CustomerMasterKeySpec::EccSecgP256K1, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::SYMMETRIC_DEFAULT {} => aws_sdk_kms::types::CustomerMasterKeySpec::SymmetricDefault, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_224 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Hmac224, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_256 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Hmac256, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_384 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Hmac384, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_512 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Hmac512, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::SM2 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Sm2, + crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_2048 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Rsa2048, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_3072 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Rsa3072, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::RSA_4096 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Rsa4096, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P256 {} => aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP256, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P384 {} => aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP384, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_NIST_P521 {} => aws_sdk_kms::types::CustomerMasterKeySpec::EccNistP521, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::ECC_SECG_P256K1 {} => aws_sdk_kms::types::CustomerMasterKeySpec::EccSecgP256K1, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::SYMMETRIC_DEFAULT {} => aws_sdk_kms::types::CustomerMasterKeySpec::SymmetricDefault, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_224 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Hmac224, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_256 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Hmac256, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_384 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Hmac384, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::HMAC_512 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Hmac512, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::CustomerMasterKeySpec::SM2 {} => aws_sdk_kms::types::CustomerMasterKeySpec::Sm2, } } diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/data_key_spec.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/data_key_spec.rs index aa96da51c..f26b83c13 100644 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/data_key_spec.rs +++ b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/data_key_spec.rs @@ -7,8 +7,8 @@ pub fn to_dafny( value: aws_sdk_kms::types::DataKeySpec, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_kms::types::DataKeySpec::Aes256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec::AES_256 {}, - aws_sdk_kms::types::DataKeySpec::Aes128 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec::AES_128 {}, + aws_sdk_kms::types::DataKeySpec::Aes256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec::AES_256 {}, +aws_sdk_kms::types::DataKeySpec::Aes128 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec::AES_128 {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -17,7 +17,7 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec, ) -> aws_sdk_kms::types::DataKeySpec { match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec::AES_256 {} => aws_sdk_kms::types::DataKeySpec::Aes256, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec::AES_128 {} => aws_sdk_kms::types::DataKeySpec::Aes128, + crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec::AES_256 {} => aws_sdk_kms::types::DataKeySpec::Aes256, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::DataKeySpec::AES_128 {} => aws_sdk_kms::types::DataKeySpec::Aes128, } } diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encryption_algorithm_spec.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encryption_algorithm_spec.rs index 8cc859bad..af802a8f4 100644 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encryption_algorithm_spec.rs +++ b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/encryption_algorithm_spec.rs @@ -7,9 +7,9 @@ pub fn to_dafny( value: aws_sdk_kms::types::EncryptionAlgorithmSpec, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_kms::types::EncryptionAlgorithmSpec::SymmetricDefault => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::SYMMETRIC_DEFAULT {}, - aws_sdk_kms::types::EncryptionAlgorithmSpec::RsaesOaepSha1 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::RSAES_OAEP_SHA_1 {}, - aws_sdk_kms::types::EncryptionAlgorithmSpec::RsaesOaepSha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::RSAES_OAEP_SHA_256 {}, + aws_sdk_kms::types::EncryptionAlgorithmSpec::SymmetricDefault => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::SYMMETRIC_DEFAULT {}, +aws_sdk_kms::types::EncryptionAlgorithmSpec::RsaesOaepSha1 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::RSAES_OAEP_SHA_1 {}, +aws_sdk_kms::types::EncryptionAlgorithmSpec::RsaesOaepSha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::RSAES_OAEP_SHA_256 {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -18,8 +18,8 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec, ) -> aws_sdk_kms::types::EncryptionAlgorithmSpec { match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::SYMMETRIC_DEFAULT {} => aws_sdk_kms::types::EncryptionAlgorithmSpec::SymmetricDefault, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::RSAES_OAEP_SHA_1 {} => aws_sdk_kms::types::EncryptionAlgorithmSpec::RsaesOaepSha1, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::RSAES_OAEP_SHA_256 {} => aws_sdk_kms::types::EncryptionAlgorithmSpec::RsaesOaepSha256, + crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::SYMMETRIC_DEFAULT {} => aws_sdk_kms::types::EncryptionAlgorithmSpec::SymmetricDefault, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::RSAES_OAEP_SHA_1 {} => aws_sdk_kms::types::EncryptionAlgorithmSpec::RsaesOaepSha1, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::EncryptionAlgorithmSpec::RSAES_OAEP_SHA_256 {} => aws_sdk_kms::types::EncryptionAlgorithmSpec::RsaesOaepSha256, } } diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_agreement_algorithm_spec.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_agreement_algorithm_spec.rs index ab964fd2f..1693266ff 100644 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_agreement_algorithm_spec.rs +++ b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_agreement_algorithm_spec.rs @@ -7,7 +7,7 @@ pub fn to_dafny( value: aws_sdk_kms::types::KeyAgreementAlgorithmSpec, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_kms::types::KeyAgreementAlgorithmSpec::Ecdh => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyAgreementAlgorithmSpec::ECDH {}, + aws_sdk_kms::types::KeyAgreementAlgorithmSpec::Ecdh => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyAgreementAlgorithmSpec::ECDH {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -16,6 +16,6 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyAgreementAlgorithmSpec, ) -> aws_sdk_kms::types::KeyAgreementAlgorithmSpec { match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyAgreementAlgorithmSpec::ECDH {} => aws_sdk_kms::types::KeyAgreementAlgorithmSpec::Ecdh, + crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyAgreementAlgorithmSpec::ECDH {} => aws_sdk_kms::types::KeyAgreementAlgorithmSpec::Ecdh, } } diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_encryption_mechanism.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_encryption_mechanism.rs index 1dd9d0e9d..80c4b4d9b 100644 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_encryption_mechanism.rs +++ b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_encryption_mechanism.rs @@ -7,7 +7,7 @@ pub fn to_dafny( value: aws_sdk_kms::types::KeyEncryptionMechanism, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_kms::types::KeyEncryptionMechanism::RsaesOaepSha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyEncryptionMechanism::RSAES_OAEP_SHA_256 {}, + aws_sdk_kms::types::KeyEncryptionMechanism::RsaesOaepSha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyEncryptionMechanism::RSAES_OAEP_SHA_256 {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -16,6 +16,6 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyEncryptionMechanism, ) -> aws_sdk_kms::types::KeyEncryptionMechanism { match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyEncryptionMechanism::RSAES_OAEP_SHA_256 {} => aws_sdk_kms::types::KeyEncryptionMechanism::RsaesOaepSha256, + crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyEncryptionMechanism::RSAES_OAEP_SHA_256 {} => aws_sdk_kms::types::KeyEncryptionMechanism::RsaesOaepSha256, } } diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_spec.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_spec.rs index 66ae3f0dc..14c6136fc 100644 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_spec.rs +++ b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_spec.rs @@ -7,19 +7,19 @@ pub fn to_dafny( value: aws_sdk_kms::types::KeySpec, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_kms::types::KeySpec::Rsa2048 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_2048 {}, - aws_sdk_kms::types::KeySpec::Rsa3072 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_3072 {}, - aws_sdk_kms::types::KeySpec::Rsa4096 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_4096 {}, - aws_sdk_kms::types::KeySpec::EccNistP256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P256 {}, - aws_sdk_kms::types::KeySpec::EccNistP384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P384 {}, - aws_sdk_kms::types::KeySpec::EccNistP521 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P521 {}, - aws_sdk_kms::types::KeySpec::EccSecgP256K1 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_SECG_P256K1 {}, - aws_sdk_kms::types::KeySpec::SymmetricDefault => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::SYMMETRIC_DEFAULT {}, - aws_sdk_kms::types::KeySpec::Hmac224 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_224 {}, - aws_sdk_kms::types::KeySpec::Hmac256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_256 {}, - aws_sdk_kms::types::KeySpec::Hmac384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_384 {}, - aws_sdk_kms::types::KeySpec::Hmac512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_512 {}, - aws_sdk_kms::types::KeySpec::Sm2 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::SM2 {}, + aws_sdk_kms::types::KeySpec::Rsa2048 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_2048 {}, +aws_sdk_kms::types::KeySpec::Rsa3072 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_3072 {}, +aws_sdk_kms::types::KeySpec::Rsa4096 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_4096 {}, +aws_sdk_kms::types::KeySpec::EccNistP256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P256 {}, +aws_sdk_kms::types::KeySpec::EccNistP384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P384 {}, +aws_sdk_kms::types::KeySpec::EccNistP521 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P521 {}, +aws_sdk_kms::types::KeySpec::EccSecgP256K1 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_SECG_P256K1 {}, +aws_sdk_kms::types::KeySpec::SymmetricDefault => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::SYMMETRIC_DEFAULT {}, +aws_sdk_kms::types::KeySpec::Hmac224 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_224 {}, +aws_sdk_kms::types::KeySpec::Hmac256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_256 {}, +aws_sdk_kms::types::KeySpec::Hmac384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_384 {}, +aws_sdk_kms::types::KeySpec::Hmac512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_512 {}, +aws_sdk_kms::types::KeySpec::Sm2 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::SM2 {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -28,18 +28,18 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec, ) -> aws_sdk_kms::types::KeySpec { match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_2048 {} => aws_sdk_kms::types::KeySpec::Rsa2048, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_3072 {} => aws_sdk_kms::types::KeySpec::Rsa3072, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_4096 {} => aws_sdk_kms::types::KeySpec::Rsa4096, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P256 {} => aws_sdk_kms::types::KeySpec::EccNistP256, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P384 {} => aws_sdk_kms::types::KeySpec::EccNistP384, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P521 {} => aws_sdk_kms::types::KeySpec::EccNistP521, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_SECG_P256K1 {} => aws_sdk_kms::types::KeySpec::EccSecgP256K1, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::SYMMETRIC_DEFAULT {} => aws_sdk_kms::types::KeySpec::SymmetricDefault, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_224 {} => aws_sdk_kms::types::KeySpec::Hmac224, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_256 {} => aws_sdk_kms::types::KeySpec::Hmac256, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_384 {} => aws_sdk_kms::types::KeySpec::Hmac384, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_512 {} => aws_sdk_kms::types::KeySpec::Hmac512, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::SM2 {} => aws_sdk_kms::types::KeySpec::Sm2, + crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_2048 {} => aws_sdk_kms::types::KeySpec::Rsa2048, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_3072 {} => aws_sdk_kms::types::KeySpec::Rsa3072, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::RSA_4096 {} => aws_sdk_kms::types::KeySpec::Rsa4096, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P256 {} => aws_sdk_kms::types::KeySpec::EccNistP256, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P384 {} => aws_sdk_kms::types::KeySpec::EccNistP384, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_NIST_P521 {} => aws_sdk_kms::types::KeySpec::EccNistP521, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::ECC_SECG_P256K1 {} => aws_sdk_kms::types::KeySpec::EccSecgP256K1, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::SYMMETRIC_DEFAULT {} => aws_sdk_kms::types::KeySpec::SymmetricDefault, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_224 {} => aws_sdk_kms::types::KeySpec::Hmac224, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_256 {} => aws_sdk_kms::types::KeySpec::Hmac256, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_384 {} => aws_sdk_kms::types::KeySpec::Hmac384, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::HMAC_512 {} => aws_sdk_kms::types::KeySpec::Hmac512, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeySpec::SM2 {} => aws_sdk_kms::types::KeySpec::Sm2, } } diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_usage_type.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_usage_type.rs index fdf182c6d..8d2db6b3c 100644 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_usage_type.rs +++ b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/key_usage_type.rs @@ -7,10 +7,10 @@ pub fn to_dafny( value: aws_sdk_kms::types::KeyUsageType, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_kms::types::KeyUsageType::SignVerify => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::SIGN_VERIFY {}, - aws_sdk_kms::types::KeyUsageType::EncryptDecrypt => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::ENCRYPT_DECRYPT {}, - aws_sdk_kms::types::KeyUsageType::GenerateVerifyMac => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::GENERATE_VERIFY_MAC {}, - aws_sdk_kms::types::KeyUsageType::KeyAgreement => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::KEY_AGREEMENT {}, + aws_sdk_kms::types::KeyUsageType::SignVerify => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::SIGN_VERIFY {}, +aws_sdk_kms::types::KeyUsageType::EncryptDecrypt => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::ENCRYPT_DECRYPT {}, +aws_sdk_kms::types::KeyUsageType::GenerateVerifyMac => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::GENERATE_VERIFY_MAC {}, +aws_sdk_kms::types::KeyUsageType::KeyAgreement => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::KEY_AGREEMENT {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -19,9 +19,9 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType, ) -> aws_sdk_kms::types::KeyUsageType { match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::SIGN_VERIFY {} => aws_sdk_kms::types::KeyUsageType::SignVerify, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::ENCRYPT_DECRYPT {} => aws_sdk_kms::types::KeyUsageType::EncryptDecrypt, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::GENERATE_VERIFY_MAC {} => aws_sdk_kms::types::KeyUsageType::GenerateVerifyMac, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::KEY_AGREEMENT {} => aws_sdk_kms::types::KeyUsageType::KeyAgreement, + crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::SIGN_VERIFY {} => aws_sdk_kms::types::KeyUsageType::SignVerify, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::ENCRYPT_DECRYPT {} => aws_sdk_kms::types::KeyUsageType::EncryptDecrypt, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::GENERATE_VERIFY_MAC {} => aws_sdk_kms::types::KeyUsageType::GenerateVerifyMac, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::KeyUsageType::KEY_AGREEMENT {} => aws_sdk_kms::types::KeyUsageType::KeyAgreement, } } diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/origin_type.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/origin_type.rs index 79b60c37b..8878e10fa 100644 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/origin_type.rs +++ b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/origin_type.rs @@ -7,10 +7,10 @@ pub fn to_dafny( value: aws_sdk_kms::types::OriginType, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_kms::types::OriginType::AwsKms => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::AWS_KMS {}, - aws_sdk_kms::types::OriginType::External => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::EXTERNAL {}, - aws_sdk_kms::types::OriginType::AwsCloudhsm => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::AWS_CLOUDHSM {}, - aws_sdk_kms::types::OriginType::ExternalKeyStore => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::EXTERNAL_KEY_STORE {}, + aws_sdk_kms::types::OriginType::AwsKms => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::AWS_KMS {}, +aws_sdk_kms::types::OriginType::External => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::EXTERNAL {}, +aws_sdk_kms::types::OriginType::AwsCloudhsm => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::AWS_CLOUDHSM {}, +aws_sdk_kms::types::OriginType::ExternalKeyStore => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::EXTERNAL_KEY_STORE {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -19,9 +19,9 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType, ) -> aws_sdk_kms::types::OriginType { match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::AWS_KMS {} => aws_sdk_kms::types::OriginType::AwsKms, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::EXTERNAL {} => aws_sdk_kms::types::OriginType::External, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::AWS_CLOUDHSM {} => aws_sdk_kms::types::OriginType::AwsCloudhsm, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::EXTERNAL_KEY_STORE {} => aws_sdk_kms::types::OriginType::ExternalKeyStore, + crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::AWS_KMS {} => aws_sdk_kms::types::OriginType::AwsKms, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::EXTERNAL {} => aws_sdk_kms::types::OriginType::External, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::AWS_CLOUDHSM {} => aws_sdk_kms::types::OriginType::AwsCloudhsm, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::OriginType::EXTERNAL_KEY_STORE {} => aws_sdk_kms::types::OriginType::ExternalKeyStore, } } diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/signing_algorithm_spec.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/signing_algorithm_spec.rs index bc9cbeb90..4fcc04f84 100644 --- a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/signing_algorithm_spec.rs +++ b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/conversions/signing_algorithm_spec.rs @@ -7,16 +7,16 @@ pub fn to_dafny( value: aws_sdk_kms::types::SigningAlgorithmSpec, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_256 {}, - aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_384 {}, - aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_512 {}, - aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_256 {}, - aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_384 {}, - aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_512 {}, - aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_256 {}, - aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_384 {}, - aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_512 {}, - aws_sdk_kms::types::SigningAlgorithmSpec::Sm2Dsa => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::SM2DSA {}, + aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_256 {}, +aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_384 {}, +aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_512 {}, +aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_256 {}, +aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_384 {}, +aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_512 {}, +aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha256 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_256 {}, +aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha384 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_384 {}, +aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha512 => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_512 {}, +aws_sdk_kms::types::SigningAlgorithmSpec::Sm2Dsa => crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::SM2DSA {}, _ => panic!("Unknown enum variant: {}", value), }) } @@ -25,15 +25,15 @@ pub fn from_dafny( dafny_value: &crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec, ) -> aws_sdk_kms::types::SigningAlgorithmSpec { match dafny_value { - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_256 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha256, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_384 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha384, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_512 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha512, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_256 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha256, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_384 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha384, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_512 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha512, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_256 {} => aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha256, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_384 {} => aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha384, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_512 {} => aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha512, - crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::SM2DSA {} => aws_sdk_kms::types::SigningAlgorithmSpec::Sm2Dsa, + crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_256 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha256, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_384 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha384, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PSS_SHA_512 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPssSha512, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_256 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha256, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_384 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha384, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::RSASSA_PKCS1_V1_5_SHA_512 {} => aws_sdk_kms::types::SigningAlgorithmSpec::RsassaPkcs1V15Sha512, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_256 {} => aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha256, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_384 {} => aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha384, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::ECDSA_SHA_512 {} => aws_sdk_kms::types::SigningAlgorithmSpec::EcdsaSha512, +crate::r#software::amazon::cryptography::services::kms::internaldafny::types::SigningAlgorithmSpec::SM2DSA {} => aws_sdk_kms::types::SigningAlgorithmSpec::Sm2Dsa, } } diff --git a/TestModels/aws-sdks/kms-lite/runtimes/rust/src/standard_library_externs.rs b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/TestModels/aws-sdks/kms-lite/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java index b94c91756..e064c1994 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java @@ -243,15 +243,7 @@ private void generateDafny(final Path outputDir) { dafnyOtherGeneratedAspects(outputDir); - LOGGER.info("Formatting Dafny code in {}", outputDir); - runCommand( - outputDir, - "dafny", - "format", - "--function-syntax:3", - "--unicode-char:false", - "." - ); + formatDafnyCode(outputDir); handlePatching(TargetLanguage.DAFNY, outputDir); } @@ -312,16 +304,29 @@ private void dafnyOtherGeneratedAspects(final Path outputDir) { // Perhaps we can make a `smithy init` template for that instead? if (!generationAspects.isEmpty()) { - Path srcDir = outputDir.resolve("../src"); - LOGGER.info("Formatting Dafny code in {}", srcDir); - runCommand( - srcDir, - "dafny", - "format", - "--function-syntax:3", - "--unicode-char:false", - "." - ); + formatDafnyCode(outputDir.resolve("../src")); + } + } + + /** + * Formats the Dafny code in the given path using {@code dafny format}, + * but does not throw an exception if the command fails. + *

+ * This enables generating interdependent Dafny files + * across multiple smithy-dafny-codegen invocations. + */ + private void formatDafnyCode(final Path path) { + LOGGER.info("Formatting Dafny code in {}", path); + final CommandResult formatResult = runCommand( + path, + "dafny", + "format", + "--function-syntax:3", + "--unicode-char:false", + "." + ); + if (formatResult.exitCode != 0) { + LOGGER.warn("Formatting failed:\n{}", formatResult.output); } } @@ -357,7 +362,7 @@ private void generateJava(final Path outputDir, final Path testOutputDir) { javaOtherGeneratedAspects(); LOGGER.info("Formatting Java code in {}", outputDir); - runCommand( + runCommandOrThrow( outputDir, "npm", "i", @@ -365,7 +370,7 @@ private void generateJava(final Path outputDir, final Path testOutputDir) { "prettier@3", "prettier-plugin-java@2.5" ); - runCommand( + runCommandOrThrow( outputDir, "npx", "prettier@3", @@ -541,7 +546,7 @@ private void generateDotnet(final Path outputDir) { .filter(path -> path.toFile().getName().endsWith(".csproj")) .map(Path::toString) ); - runCommand(dotnetRoot, args.toArray(String[]::new)); + runCommandOrThrow(dotnetRoot, args.toArray(String[]::new)); } catch (IOException e) { throw new RuntimeException(e); } @@ -718,13 +723,17 @@ private void generateRust(final Path outputDir) { generator.generate(outputDir); } - // TODO: This should be part of the StandardLibrary instead, + // TODO: These should be part of the StandardLibrary instead, // but since the Dafny Rust code generator doesn't yet support multiple crates, // we have to inline it instead. writeTemplatedFile( "runtimes/rust/src/standard_library_conversions.rs", Map.of() ); + writeTemplatedFile( + "runtimes/rust/src/standard_library_externs.rs", + Map.of() + ); handlePatching(TargetLanguage.RUST, outputDir); } @@ -762,13 +771,14 @@ private void handlePatching(TargetLanguage targetLanguage, Path outputDir) { ); Path outputDirRelative = libraryRoot.relativize(outputDir); // Need to ignore the exit code because diff will return 1 if there is a diff - String patchContent = runCommandIgnoringExitCode( + String patchContent = runCommand( libraryRoot, "git", "diff", "-R", outputDirRelative.toString() - ); + ) + .output; if (!patchContent.isBlank()) { IOUtils.writeToFile(patchContent, patchFile.toFile()); } @@ -784,7 +794,13 @@ private void handlePatching(TargetLanguage targetLanguage, Path outputDir) { if (dafnyVersion.compareTo(patchFilePair.getKey()) >= 0) { Path patchFile = patchFilePair.getValue(); LOGGER.info("Applying patch file {}", patchFile); - runCommand(libraryRoot, "git", "apply", "-v", patchFile.toString()); + runCommandOrThrow( + libraryRoot, + "git", + "apply", + "-v", + patchFile.toString() + ); return; } } @@ -914,7 +930,10 @@ private String extraDeclarationsForLocalService() { pub mod operation; mod conversions; + + /// Copied from StandardLibrary mod standard_library_conversions; + mod standard_library_externs; #[cfg(feature = "wrapped-client")] pub mod wrapped; @@ -932,26 +951,34 @@ private String extraDeclarationsForLocalService() { ); } - private String runCommand(Path workingDir, String... args) { - List argsList = List.of(args); - StringBuilder output = new StringBuilder(); - int exitCode = IoUtils.runCommand( + private record CommandResult(int exitCode, String output) {} + + /** + * Runs the given command and throws an exception if the exit code is nonzero. + */ + private String runCommandOrThrow(Path workingDir, String... args) { + final CommandResult result = runCommand(workingDir, args); + if (result.exitCode != 0) { + throw new RuntimeException( + "Command failed: " + List.of(args) + "\n" + result.output + ); + } + return result.output; + } + + /** + * Runs the given command. + */ + private CommandResult runCommand(Path workingDir, String... args) { + final List argsList = List.of(args); + final StringBuilder output = new StringBuilder(); + final int exitCode = IoUtils.runCommand( argsList, workingDir, output, Collections.emptyMap() ); - if (exitCode != 0) { - throw new RuntimeException("Command failed: " + argsList + "\n" + output); - } - return output.toString(); - } - - private String runCommandIgnoringExitCode(Path workingDir, String... args) { - List argsList = List.of(args); - StringBuilder output = new StringBuilder(); - IoUtils.runCommand(argsList, workingDir, output, Collections.emptyMap()); - return output.toString(); + return new CommandResult(exitCode, output.toString()); } private Path standardLibraryPath() { diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/TypeConversionCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/TypeConversionCodegen.java index c955b48e2..05494838e 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/TypeConversionCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/TypeConversionCodegen.java @@ -114,6 +114,7 @@ public Map generate() { Stream.of(typeConverter.fromDafny, typeConverter.toDafny) ) ) + .prepend(conversionConstants()) .lineSeparated() .braced(); final TokenTree conversionClass = conversionClassBody @@ -122,6 +123,16 @@ public Map generate() { return Map.of(TYPE_CONVERSION_CLASS_PATH, conversionClass.prepend(prelude)); } + private static TokenTree conversionConstants() { + return TokenTree.of( + """ + private const string ISO8601DateFormat = "yyyy-MM-dd\\\\THH:mm:ss.fff\\\\Z"; + + private const string ISO8601DateFormatNoMS = "yyyy-MM-dd\\\\THH:mm:ss\\\\Z"; + """ + ); + } + /** * Returns a stream of type converters for synthetic types (types that aren't defined in the model). */ @@ -383,15 +394,13 @@ public TypeConverter generateTimestampConverter( ) { final TokenTree fromDafnyBody = Token.of( """ - System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(""); string timestampString = new string(value.Elements); - return System.DateTime.ParseExact(timestampString, "s", culture); + return System.DateTime.ParseExact(timestampString, new[] {ISO8601DateFormat, ISO8601DateFormatNoMS}, System.Globalization.CultureInfo.InvariantCulture); """ ); final TokenTree toDafnyBody = Token.of( """ - System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(""); - string timestampString = value.ToString("s", culture); + string timestampString = value.ToString(ISO8601DateFormat, System.Globalization.CultureInfo.InvariantCulture); return Dafny.Sequence.FromString(timestampString); """ ); diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/AbstractRustShimGenerator.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/AbstractRustShimGenerator.java index 7a67e7103..5319e4a0d 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/AbstractRustShimGenerator.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/AbstractRustShimGenerator.java @@ -8,15 +8,19 @@ import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; +import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; import software.amazon.polymorph.utils.IOUtils; +import software.amazon.polymorph.utils.MapUtils; +import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.utils.TokenTree; -import software.amazon.smithy.aws.traits.ServiceTrait; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.knowledge.OperationIndex; +import software.amazon.smithy.model.shapes.EnumShape; import software.amazon.smithy.model.shapes.ListShape; import software.amazon.smithy.model.shapes.MapShape; import software.amazon.smithy.model.shapes.MemberShape; @@ -26,7 +30,6 @@ import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.StructureShape; import software.amazon.smithy.model.shapes.UnionShape; -import software.amazon.smithy.model.traits.EnumDefinition; import software.amazon.smithy.model.traits.EnumTrait; import software.amazon.smithy.model.traits.ErrorTrait; import software.amazon.smithy.model.traits.RequiredTrait; @@ -103,7 +106,7 @@ protected RustFile conversionsErrorModule() { evalTemplate( getClass(), "runtimes/rust/conversions/error.rs", - dafnyModuleVariables() + serviceVariables() ) ); return new RustFile( @@ -122,17 +125,6 @@ protected TokenTree declarePubModules(Stream moduleNames) { .lineSeparated(); } - protected Map dafnyModuleVariables() { - final Map stringStringMap = new HashMap<>(); - stringStringMap.put("dafnyModuleName", getDafnyModuleName()); - stringStringMap.put( - "dafnyInternalModuleName", - getDafnyInternalModuleName() - ); - stringStringMap.put("dafnyTypesModuleName", getDafnyTypesModuleName()); - return stringStringMap; - } - protected RustFile conversionsModule() { Stream operationModules = model .getOperationShapes() @@ -153,9 +145,8 @@ protected RustFile conversionsModule() { .filter(this::shouldGenerateEnumForUnion) .map(structureShape -> toSnakeCase(structureShape.getId().getName())); - Stream enumModules = model - .getStringShapesWithTrait(EnumTrait.class) - .stream() + Stream enumModules = ModelUtils + .streamEnumShapes(model, service.getId().getNamespace()) .map(structureShape -> toSnakeCase(structureShape.getId().getName())); TokenTree content = declarePubModules( @@ -301,8 +292,8 @@ private TokenTree fromDafny( boolean isDafnyOption ) { return switch (shape.getType()) { - case STRING -> { - if (shape.hasTrait(EnumTrait.class)) { + case STRING, ENUM -> { + if (shape.hasTrait(EnumTrait.class) || shape.isEnumShape()) { var enumShapeName = toSnakeCase(shape.toShapeId().getName()); if (isDafnyOption) { yield TokenTree.of( @@ -328,6 +319,30 @@ private TokenTree fromDafny( } yield result; } + } else if (shape.hasTrait(DafnyUtf8BytesTrait.class)) { + final String dafnyToRust = + "::std::string::String::from_utf8(dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&%s, |b| *b)).unwrap()"; + String valueToRust; + if (isDafnyOption) { + valueToRust = + """ + match %s.as_ref() { + crate::_Wrappers_Compile::Option::Some { .. } => ::std::option::Option::Some(%s), + _ => ::std::option::Option::None, + }""".formatted( + dafnyValue, + dafnyToRust.formatted(dafnyValue + ".Extract()") + ); + if (!isRustOption) { + valueToRust = "(%s).unwrap()".formatted(valueToRust); + } + } else { + valueToRust = dafnyToRust.formatted(dafnyValue + ".as_ref()"); + if (isRustOption) { + valueToRust = "Some(%s)".formatted(valueToRust); + } + } + yield TokenTree.of(valueToRust); } else { if (isDafnyOption) { yield TokenTree.of( @@ -571,21 +586,30 @@ private TokenTree toDafnyVariantMemberForOperationRequest( ) { Shape targetShape = model.expectShape(member.getTarget()); String snakeCaseMemberName = toSnakeCase(member.getMemberName()); - boolean isRequired = member.hasTrait(RequiredTrait.class); - // These rules were mostly reverse-engineered from inspection of Rust SDKs, - // and may not be complete! - boolean isRustRequired = - (isRequired && - !operationIndex.isOutputStructure(parent) && - !operationIndex.isInputStructure(parent) && - !targetShape.isStructureShape()) || - (operationIndex.isOutputStructure(parent) && - targetShape.isIntegerShape()); return toDafny( targetShape, "value." + snakeCaseMemberName, - !isRustRequired, - !isRequired + !isRustFieldRequired(parent, member), + !hasRequiredTrait(member) + ); + } + + protected final boolean hasRequiredTrait(final MemberShape member) { + return member.hasTrait(RequiredTrait.class); + } + + protected boolean isRustFieldRequired( + final Shape parent, + final MemberShape member + ) { + // These rules were mostly reverse-engineered from inspection of Rust SDKs, + // and may not be complete! + final Shape targetShape = model.expectShape(member.getTarget()); + return ( + hasRequiredTrait(member) && + !operationIndex.isOutputStructure(parent) && + !operationIndex.isInputStructure(parent) && + !targetShape.isStructureShape() ); } @@ -604,8 +628,8 @@ private TokenTree toDafny( boolean isDafnyOption ) { return switch (shape.getType()) { - case STRING -> { - if (shape.hasTrait(EnumTrait.class)) { + case STRING, ENUM -> { + if (shape.hasTrait(EnumTrait.class) || shape.isEnumShape()) { var enumShapeName = toSnakeCase(shape.toShapeId().getName()); if (isDafnyOption) { yield TokenTree.of( @@ -631,6 +655,24 @@ private TokenTree toDafny( ) ); } + } else if (shape.hasTrait(DafnyUtf8BytesTrait.class)) { + final String rustToDafny = + "dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&%s.as_bytes().to_vec(), |b| *b)"; + String valueToDafny; + if (isRustOption) { + valueToDafny = + """ + match %s { + Some(s) => crate::_Wrappers_Compile::Option::Some { value: %s }, + None => crate::_Wrappers_Compile::Option::None {}, + }""".formatted(rustValue, rustToDafny.formatted("s")); + if (!isDafnyOption) { + valueToDafny = "(%s).Extract()".formatted(valueToDafny); + } + } else { + valueToDafny = rustToDafny.formatted(rustValue); + } + yield TokenTree.of("::std::rc::Rc::new(%s)".formatted(valueToDafny)); } else { if (isRustOption) { var result = TokenTree.of( @@ -867,154 +909,82 @@ private TokenTree toDafny( }; } - protected TokenTree enumToDafnyFunction(final Shape enumShape) { - String enumName = enumShape.getId().getName(); - String rustEnumName = toPascalCase(enumName); - String sdkId = service - .expectTrait(ServiceTrait.class) - .getSdkId() - .toLowerCase(); - String dafnyTypesModuleName = getDafnyTypesModuleName(); - Map variables = Map.of( - "sdkCrate", - "aws_sdk_" + sdkId, - "enumName", - enumName, - "rustEnumName", - rustEnumName, - "dafnyTypesModuleName", - dafnyTypesModuleName - ); - - String sdkTypeName = evalTemplate( - "$sdkCrate:L::types::$rustEnumName:L", - variables + protected TokenTree enumToDafnyFunction(final EnumShape enumShape) { + final Map variables = MapUtils.merge( + serviceVariables(), + enumVariables(enumShape) ); + var branches = enumShape + .getEnumValues() + .keySet() + .stream() + .map(memberName -> + evalTemplate( + "$rustTypesModuleName:L::$rustEnumName:L::$rustEnumMemberName:L => crate::r#$dafnyTypesModuleName:L::$enumName:L::$dafnyEnumMemberName:L {},", + MapUtils.merge(variables, enumMemberVariables(memberName)) + ) + ) + .collect(Collectors.joining("\n")); + variables.put("branches", branches); - var prelude = TokenTree.of( + // TODO: This should not be a panic, but the Dafny image of the enum shape doesn't have an Unknown variant of any kind, + // so there's no way to succeed. + // See https://github.com/smithy-lang/smithy-dafny/issues/476. + // This could be handled more cleanly if conversion functions returned Results, + // but that would be a large and disruptive change to the overall code flow. + return TokenTree.of( evalTemplate( """ #[allow(dead_code)] pub fn to_dafny( - value: $sdkCrate:L::types::$rustEnumName:L, + value: $rustTypesModuleName:L::$rustEnumName:L, ) -> ::std::rc::Rc{ ::std::rc::Rc::new(match value { - + $branches:L + _ => panic!("Unknown enum variant: {}", value), + }) + } """, variables ) ); - - var branches = TokenTree - .of( - enumShape - .expectTrait(EnumTrait.class) - .getValues() - .stream() - .map(e -> - TokenTree.of( - sdkTypeName + - "::" + - rustEnumName(e) + - " => crate::r#" + - dafnyTypesModuleName + - "::" + - enumName + - "::" + - dafnyEnumName(e) + - " {}," - ) - ) - ) - .lineSeparated(); - // TODO: This should not be a panic, but the Dafny image of the enum shape doesn't have an Unknown variant of any kind, - // so there's no way to succeed. - // See https://github.com/smithy-lang/smithy-dafny/issues/476. - // This could be handled more cleanly if conversion functions returned Results, - // but that would be a large and disruptive change to the overall code flow. - final var postlude = TokenTree.of( - """ - - _ => panic!("Unknown enum variant: {}", value), - }) - } - """ - ); - - return TokenTree.of(prelude, branches, postlude); } - protected TokenTree enumFromDafnyFunction(final Shape enumShape) { - String enumName = enumShape.getId().getName(); - String rustEnumName = toPascalCase(enumName); - String sdkId = service - .expectTrait(ServiceTrait.class) - .getSdkId() - .toLowerCase(); - String dafnyTypesModuleName = getDafnyTypesModuleName(); - Map variables = Map.of( - "sdkCrate", - "aws_sdk_" + sdkId, - "enumName", - enumName, - "rustEnumName", - rustEnumName, - "dafnyTypesModuleName", - dafnyTypesModuleName + protected TokenTree enumFromDafnyFunction(final EnumShape enumShape) { + final Map variables = MapUtils.merge( + serviceVariables(), + enumVariables(enumShape) ); - String sdkTypeName = evalTemplate( - "$sdkCrate:L::types::$rustEnumName:L", - variables - ); + var branches = enumShape + .getEnumValues() + .keySet() + .stream() + .map(memberName -> + evalTemplate( + "crate::r#$dafnyTypesModuleName:L::$enumName:L::$dafnyEnumMemberName:L {} => $rustTypesModuleName:L::$rustEnumName:L::$rustEnumMemberName:L,", + MapUtils.merge(variables, enumMemberVariables(memberName)) + ) + ) + .collect(Collectors.joining("\n")); + variables.put("branches", branches); - var prelude = TokenTree.of( + return TokenTree.of( evalTemplate( """ #[allow(dead_code)] pub fn from_dafny( dafny_value: &crate::r#$dafnyTypesModuleName:L::$enumName:L, - ) -> $sdkCrate:L::types::$rustEnumName:L { + ) -> $rustTypesModuleName:L::$rustEnumName:L { match dafny_value { - + $branches:L + } + } """, variables ) ); - - var branches = TokenTree - .of( - enumShape - .expectTrait(EnumTrait.class) - .getValues() - .stream() - .map(e -> - TokenTree.of( - "crate::r#" + - dafnyTypesModuleName + - "::" + - enumName + - "::" + - dafnyEnumName(e) + - " {} => " + - sdkTypeName + - "::" + - rustEnumName(e) + - "," - ) - ) - ) - .lineSeparated(); - final var postlude = TokenTree.of( - """ - - } - } - """ - ); - - return TokenTree.of(prelude, branches, postlude); } protected Set allOperationConversionModules() { @@ -1028,16 +998,40 @@ protected abstract Set operationConversionModules( final OperationShape operationShape ); - private String rustEnumName(EnumDefinition ed) { - return toPascalCase(ed.getValue()); + protected RustFile enumConversionModule(final EnumShape enumShape) { + Path path = Path.of( + "src", + "conversions", + toSnakeCase(enumName(enumShape)) + ".rs" + ); + + return new RustFile( + path, + TokenTree + .of(enumToDafnyFunction(enumShape), enumFromDafnyFunction(enumShape)) + .lineSeparated() + ); } - private String dafnyEnumName(EnumDefinition ed) { - return ed.getValue(); + /** + * Generates values for variables commonly used in service-specific templates. + */ + protected HashMap serviceVariables() { + final HashMap variables = new HashMap<>(); + variables.put("serviceName", service.getId().getName(service)); + variables.put("dafnyModuleName", getDafnyModuleName()); + variables.put("dafnyInternalModuleName", getDafnyInternalModuleName()); + variables.put("dafnyTypesModuleName", getDafnyTypesModuleName()); + variables.put("rustTypesModuleName", getRustTypesModuleName()); + return variables; } protected String getDafnyModuleName() { - return service.getId().getNamespace().replace(".", "::"); + return service + .getId() + .getNamespace() + .replace(".", "::") + .toLowerCase(Locale.ROOT); } protected String getDafnyInternalModuleName() { @@ -1048,14 +1042,7 @@ protected String getDafnyTypesModuleName() { return "%s::types".formatted(getDafnyInternalModuleName()); } - /** - * Generates values for variables commonly used in service-specific templates. - */ - protected HashMap serviceVariables() { - final HashMap variables = new HashMap<>(); - variables.put("serviceName", service.getId().getName(service)); - return variables; - } + protected abstract String getRustTypesModuleName(); /** * Generates values for variables commonly used in operation-specific templates. @@ -1066,6 +1053,8 @@ protected HashMap operationVariables( final String opName = operationName(operationShape); final String opInputName = operationInputName(operationShape); final String opOutputName = operationOutputName(operationShape); + final String synOpInputName = syntheticOperationInputName(operationShape); + final String synOpOutputName = syntheticOperationOutputName(operationShape); final String snakeCaseOpName = toSnakeCase(opName); final HashMap variables = new HashMap<>(); @@ -1073,16 +1062,18 @@ protected HashMap operationVariables( variables.put("operationInputName", opInputName); variables.put("operationOutputName", opOutputName); variables.put("operationErrorName", operationErrorTypeName(operationShape)); + variables.put("syntheticOperationInputName", synOpInputName); + variables.put("syntheticOperationOutputName", synOpOutputName); variables.put("snakeCaseOperationName", snakeCaseOpName); variables.put("snakeCaseOperationInputName", toSnakeCase(opInputName)); variables.put("snakeCaseOperationOutputName", toSnakeCase(opOutputName)); variables.put( - "syntheticOperationInputName", - syntheticOperationInputName(operationShape) + "snakeCaseSyntheticOperationInputName", + toSnakeCase(synOpInputName) ); variables.put( - "syntheticOperationOutputName", - syntheticOperationOutputName(operationShape) + "snakeCaseSyntheticOperationOutputName", + toSnakeCase(synOpOutputName) ); return variables; } @@ -1111,43 +1102,46 @@ protected String operationErrorTypeName(final OperationShape operationShape) { return "%sError".formatted(operationName(operationShape)); } - /** - * Generates values for variables commonly used in structure-member-specific templates. - */ - protected HashMap memberVariables( - final MemberShape memberShape - ) { + protected String enumName(final EnumShape enumShape) { + return enumShape.getId().getName(service); + } + + protected String rustEnumName(final EnumShape enumShape) { + return toPascalCase(enumName(enumShape)); + } + + protected String qualifiedRustEnumType(final EnumShape enumShape) { + return "%s::%s".formatted( + getRustTypesModuleName(), + rustEnumName(enumShape) + ); + } + + protected HashMap enumVariables(final EnumShape enumShape) { final HashMap variables = new HashMap<>(); - variables.put("fieldName", toSnakeCase(memberShape.getMemberName())); - variables.put( - "fieldType", - rustTypeForShape(model.expectShape(memberShape.getTarget())) - ); + final String enumName = enumName(enumShape); + variables.put("enumName", enumName); + variables.put("snakeCaseEnumName", toSnakeCase(enumName)); + variables.put("rustEnumName", rustEnumName(enumShape)); + variables.put("qualifiedRustEnumType", qualifiedRustEnumType(enumShape)); return variables; } - // Currently only handles simple types, and doesn't account for any traits - protected String rustTypeForShape(final Shape shape) { - return switch (shape.getType()) { - case BOOLEAN -> "::std::primitive::bool"; - // integral - case BYTE -> "::std::primitive::i8"; - case SHORT -> "::std::primitive::i16"; - case INTEGER -> "::std::primitive::i32"; - case LONG -> "::std::primitive::i64"; - // floats - case FLOAT -> "::std::primitive::f32"; - case DOUBLE -> "::std::primitive::f64"; - // special numerics - case BIG_INTEGER -> "::num::bigint::BigInt"; - case BIG_DECIMAL -> "::num::rational::BigRational"; - // special collections - case BLOB -> "::std::vec::Vec<::std::primitive::u8>"; - case STRING -> "::std::string::String"; - // TODO: enum, list, map, structure, union - default -> throw new UnsupportedOperationException( - "Unsupported shape type: " + shape.getType() - ); - }; + protected String rustEnumMemberName(final String memberName) { + return toPascalCase(memberName); + } + + protected String dafnyEnumMemberName(final String memberName) { + return memberName; + } + + protected HashMap enumMemberVariables( + final String memberName + ) { + final HashMap variables = new HashMap<>(); + variables.put("enumMemberName", memberName); + variables.put("dafnyEnumMemberName", dafnyEnumMemberName(memberName)); + variables.put("rustEnumMemberName", rustEnumMemberName(memberName)); + return variables; } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustAwsSdkShimGenerator.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustAwsSdkShimGenerator.java index 3c08de804..ca2ecf80e 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustAwsSdkShimGenerator.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustAwsSdkShimGenerator.java @@ -13,15 +13,16 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import software.amazon.polymorph.utils.MapUtils; +import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.utils.TokenTree; import software.amazon.smithy.aws.traits.ServiceTrait; import software.amazon.smithy.model.Model; +import software.amazon.smithy.model.shapes.MemberShape; import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.StructureShape; -import software.amazon.smithy.model.traits.EnumTrait; /** * Generates all Rust modules needed to wrap @@ -47,11 +48,10 @@ protected Set rustFiles() { ); result.addAll( - model - .getStringShapesWithTrait(EnumTrait.class) - .stream() + ModelUtils + .streamEnumShapes(model, service.getId().getNamespace()) .map(this::enumConversionModule) - .collect(Collectors.toSet()) + .toList() ); result.add(conversionsModule()); @@ -64,12 +64,7 @@ protected Set rustFiles() { } private RustFile clientModule() { - final Map variables = MapUtils.merge( - serviceVariables(), - dafnyModuleVariables() - ); - variables.put("clientName", "%sClient".formatted(getSdkId())); - + final Map variables = serviceVariables(); var preamble = TokenTree.of( evalTemplate( """ @@ -152,10 +147,8 @@ private TokenTree operationClientFunction( ) { final Map variables = MapUtils.merge( serviceVariables(), - dafnyModuleVariables(), operationVariables(operationShape) ); - variables.put("clientName", "%sClient".formatted(getSdkId())); final ShapeId outputShapeId = operationShape.getOutputShape(); final String outputType = outputShapeId.equals( @@ -221,7 +214,7 @@ private TokenTree structureToDafnyFunction( """ #[allow(dead_code)] pub fn to_dafny( - value: &$sdkCrate:L::types::$rustStructureName:L, + value: &$rustTypesModuleName:L::$rustStructureName:L, ) -> ::std::rc::Rc{ ::std::rc::Rc::new( crate::r#$dafnyTypesModuleName:L::$structureName:L::$structureName:L { @@ -230,10 +223,7 @@ pub fn to_dafny( ) } """; - final Map variables = MapUtils.merge( - serviceVariables(), - dafnyModuleVariables() - ); + final Map variables = serviceVariables(); variables.put("structureName", structureName); variables.put("rustStructureName", toPascalCase(structureName)); variables.put( @@ -259,10 +249,7 @@ private TokenTree structureFromDafnyFunction( ) ? ".unwrap()" : ""; - final Map variables = MapUtils.merge( - serviceVariables(), - dafnyModuleVariables() - ); + final Map variables = serviceVariables(); variables.put("structureName", structureName); variables.put("rustStructureName", toPascalCase(structureName)); variables.put("snakeCaseStructureName", toSnakeCase(structureName)); @@ -280,8 +267,8 @@ pub fn from_dafny( dafny_value: ::std::rc::Rc< crate::r#$dafnyTypesModuleName:L::$structureName:L, >, - ) -> $sdkCrate:L::types::$rustStructureName:L { - $sdkCrate:L::types::$rustStructureName:L::builder() + ) -> $rustTypesModuleName:L::$rustStructureName:L { + $rustTypesModuleName:L::$rustStructureName:L::builder() $fluentMemberSetters:L .build() $unwrapIfNeeded:L @@ -298,7 +285,6 @@ protected TokenTree operationRequestToDafnyFunction( ) { final Map variables = MapUtils.merge( serviceVariables(), - dafnyModuleVariables(), operationVariables(operationShape) ); StructureShape inputShape = model.expectShape( @@ -329,13 +315,23 @@ pub fn to_dafny( ); } + @Override + protected boolean isRustFieldRequired(Shape parent, MemberShape member) { + // These rules were mostly reverse-engineered from inspection of Rust SDKs, + // and may not be complete! + final Shape targetShape = model.expectShape(member.getTarget()); + return ( + super.isRustFieldRequired(parent, member) || + (operationIndex.isOutputStructure(parent) && targetShape.isIntegerShape()) + ); + } + @Override protected TokenTree operationRequestFromDafnyFunction( final OperationShape operationShape ) { final Map variables = MapUtils.merge( serviceVariables(), - dafnyModuleVariables(), operationVariables(operationShape) ); StructureShape inputShape = model.expectShape( @@ -372,7 +368,6 @@ protected TokenTree operationResponseToDafnyFunction( ) { final Map variables = MapUtils.merge( serviceVariables(), - dafnyModuleVariables(), operationVariables(operationShape) ); StructureShape outputShape = model.expectShape( @@ -473,7 +468,6 @@ protected TokenTree operationErrorToDafnyFunction( final Map variables = MapUtils.merge( serviceVariables(), - dafnyModuleVariables(), operationVariables(operationShape) ); variables.put("errorCases", errorCases.toString()); @@ -511,7 +505,6 @@ protected TokenTree errorVariantToDafny( ) { final Map variables = MapUtils.merge( serviceVariables(), - dafnyModuleVariables(), operationVariables(operationShape) ); String errorName = toPascalCase(errorShape.getId().getName()); @@ -538,7 +531,7 @@ private RustFile errorConversionModule(final Shape errorStructure) { """ #[allow(dead_code)] pub fn to_dafny( - value: $sdkCrate:L::types::error::$pascalCaseName:L, + value: $rustTypesModuleName:L::error::$pascalCaseName:L, ) -> ::std::rc::Rc{ ::std::rc::Rc::new( crate::r#$dafnyTypesModuleName:L::Error::$structureName:L { @@ -547,34 +540,14 @@ pub fn to_dafny( ) } """; - final Map variables = MapUtils.merge( - serviceVariables(), - dafnyModuleVariables() - ); + final Map variables = serviceVariables(); variables.put("structureName", structureName); variables.put("pascalCaseName", pascalCaseName); variables.put( "variants", toDafnyVariantsForStructure(errorStructure).toString() ); - String evaluated = evalTemplate(template, variables); - return new RustFile(path, TokenTree.of(evaluated)); - } - - private RustFile enumConversionModule(final Shape enumShape) { - Path path = Path.of( - "src", - "conversions", - toSnakeCase(enumShape.getId().getName()) + ".rs" - ); - - return new RustFile( - path, - TokenTree.of( - enumToDafnyFunction(enumShape), - enumFromDafnyFunction(enumShape) - ) - ); + return new RustFile(path, TokenTree.of(evalTemplate(template, variables))); } @Override @@ -584,6 +557,11 @@ protected String getDafnyModuleName() { ); } + @Override + protected String getRustTypesModuleName() { + return "%s::types".formatted(getSdkCrate()); + } + private String getSdkId() { return service.expectTrait(ServiceTrait.class).getSdkId(); } @@ -595,8 +573,10 @@ private String getSdkCrate() { @Override protected HashMap serviceVariables() { final HashMap variables = super.serviceVariables(); - variables.put("sdkId", getSdkId()); + final String sdkId = getSdkId(); + variables.put("sdkId", sdkId); variables.put("sdkCrate", getSdkCrate()); + variables.put("clientName", "%sClient".formatted(sdkId)); return variables; } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustLibraryShimGenerator.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustLibraryShimGenerator.java index dbf694082..180fd1b8d 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustLibraryShimGenerator.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyrust/generator/RustLibraryShimGenerator.java @@ -1,6 +1,7 @@ package software.amazon.polymorph.smithyrust.generator; import static software.amazon.polymorph.utils.IOUtils.evalTemplate; +import static software.amazon.smithy.rust.codegen.core.util.StringsKt.toPascalCase; import static software.amazon.smithy.rust.codegen.core.util.StringsKt.toSnakeCase; import java.nio.file.Path; @@ -17,12 +18,14 @@ import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.utils.TokenTree; import software.amazon.smithy.model.Model; +import software.amazon.smithy.model.shapes.EnumShape; import software.amazon.smithy.model.shapes.MemberShape; import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.StructureShape; +import software.amazon.smithy.model.traits.EnumTrait; /** * Generates all Rust modules needed to wrap a Dafny library as a Rust library. @@ -62,6 +65,12 @@ protected Set rustFiles() { // types result.add(typesModule()); result.add(typesConfigModule()); + result.addAll( + ModelUtils + .streamEnumShapes(model, service.getId().getNamespace()) + .map(this::enumTypeModule) + .toList() + ); // errors result.add(errorModule()); @@ -81,8 +90,13 @@ protected Set rustFiles() { result.add(conversionsErrorModule()); result.addAll(configConversionModules()); result.addAll(allOperationConversionModules()); + result.addAll( + ModelUtils + .streamEnumShapes(model, service.getId().getNamespace()) + .map(this::enumConversionModule) + .toList() + ); // TODO structure conversion modules - // TODO enum conversion modules // TODO union conversion modules // wrapped client @@ -93,10 +107,7 @@ protected Set rustFiles() { } private RustFile clientModule() { - final Map variables = MapUtils.merge( - dafnyModuleVariables(), - serviceVariables() - ); + final Map variables = serviceVariables(); variables.put( "operationModules", serviceOperationShapes() @@ -191,10 +202,26 @@ private String operationClientOutputDoc(final OperationShape operationShape) { } private RustFile typesModule() { + final Map variables = serviceVariables(); + + final String enumModules = ModelUtils + .streamEnumShapes(model, service.getId().getNamespace()) + .map(enumShape -> + IOUtils.evalTemplate( + """ + mod _$snakeCaseEnumName:L; + pub use crate::types::_$snakeCaseEnumName:L::$rustEnumName:L; + """, + enumVariables(enumShape) + ) + ) + .collect(Collectors.joining("\n")); + variables.put("enumModules", enumModules); + final String content = IOUtils.evalTemplate( getClass(), "runtimes/rust/types.rs", - serviceVariables() + variables ); return new RustFile(Path.of("src", "types.rs"), TokenTree.of(content)); } @@ -214,6 +241,46 @@ private RustFile typesConfigModule() { return new RustFile(path, TokenTree.of(content)); } + private RustFile enumTypeModule(final EnumShape enumShape) { + final Map variables = MapUtils.merge( + serviceVariables(), + enumVariables(enumShape) + ); + + final Set memberNames = enumShape.getEnumValues().keySet(); + + final String variants = memberNames + .stream() + .map(this::rustEnumMemberName) + .map("%s,"::formatted) + .collect(Collectors.joining("\n")); + variables.put("variants", variants); + + final String displayVariants = memberNames + .stream() + .map(memberName -> + IOUtils.evalTemplate( + "$rustEnumName:L::$rustEnumMemberName:L => write!(f, \"$enumMemberName:L\"),", + MapUtils.merge(variables, enumMemberVariables(memberName)) + ) + ) + .collect(Collectors.joining("\n")); + variables.put("displayVariants", displayVariants); + + final String content = IOUtils.evalTemplate( + getClass(), + "runtimes/rust/types/enum.rs", + variables + ); + + final Path path = Path.of( + "src", + "types", + "_%s.rs".formatted(toSnakeCase(enumName(enumShape))) + ); + return new RustFile(path, TokenTree.of(content)); + } + private RustFile operationModule() { final String opTemplate = """ @@ -319,14 +386,22 @@ private String operationStructureField(final MemberShape memberShape) { } private String operationStructureGetter(final MemberShape memberShape) { + final Map variables = memberVariables(memberShape); + + // for some simple shapes, the Rust runtime types are not Copy + final Shape targetShape = model.expectShape(memberShape.getTarget()); + final boolean needsClone = + targetShape.isBlobShape() || targetShape.isStringShape(); + variables.put("fieldClone", needsClone ? ".clone()" : ""); + final String template = """ #[allow(missing_docs)] // documentation missing in model pub fn $fieldName:L(&self) -> ::std::option::Option<$fieldType:L> { - self.$fieldName:L + self.$fieldName:L$fieldClone:L } """; - return IOUtils.evalTemplate(template, memberVariables(memberShape)); + return IOUtils.evalTemplate(template, variables); } private String operationStructureBuilderField(final MemberShape memberShape) { @@ -440,10 +515,7 @@ private RustFile errorConversionModule( } private Set configConversionModules() { - final Map variables = MapUtils.merge( - serviceVariables(), - dafnyModuleVariables() - ); + final Map variables = serviceVariables(); final String snakeCaseConfigName = variables.get("snakeCaseConfigName"); final String outerContent = IOUtils.evalTemplate( @@ -486,7 +558,6 @@ protected Set operationConversionModules( ) { final Map variables = MapUtils.merge( serviceVariables(), - dafnyModuleVariables(), operationVariables(operationShape) ); @@ -543,7 +614,6 @@ private TokenTree operationStructureToDafnyFunction( ); final Map variables = MapUtils.merge( serviceVariables(), - dafnyModuleVariables(), operationVariables(operationShape) ); variables.put("structureName", structureId.getName(service)); @@ -601,7 +671,6 @@ private TokenTree operationStructureFromDafnyFunction( ); final Map variables = MapUtils.merge( serviceVariables(), - dafnyModuleVariables(), operationVariables(operationShape) ); variables.put("structureName", structureId.getName(service)); @@ -635,16 +704,13 @@ private RustFile wrappedModule() { final String content = IOUtils.evalTemplate( getClass(), "runtimes/rust/wrapped.rs", - MapUtils.merge(serviceVariables(), dafnyModuleVariables()) + serviceVariables() ); return new RustFile(Path.of("src", "wrapped.rs"), TokenTree.of(content)); } private RustFile wrappedClientModule() { - final Map variables = MapUtils.merge( - serviceVariables(), - dafnyModuleVariables() - ); + final Map variables = serviceVariables(); variables.put( "operationImpls", serviceOperationShapes() @@ -667,7 +733,6 @@ private String wrappedClientOperationImpl( ) { final Map variables = MapUtils.merge( serviceVariables(), - dafnyModuleVariables(), operationVariables(operationShape) ); return IOUtils.evalTemplate( @@ -704,6 +769,11 @@ protected HashMap serviceVariables() { return variables; } + @Override + protected String getRustTypesModuleName() { + return "crate::types"; + } + @Override protected String syntheticOperationInputName(OperationShape operationShape) { return operationName(operationShape) + "Input"; @@ -713,4 +783,55 @@ protected String syntheticOperationInputName(OperationShape operationShape) { protected String syntheticOperationOutputName(OperationShape operationShape) { return operationName(operationShape) + "Output"; } + + /** + * Generates values for variables commonly used in structure-member-specific templates. + */ + private HashMap memberVariables( + final MemberShape memberShape + ) { + final HashMap variables = new HashMap<>(); + variables.put("fieldName", toSnakeCase(memberShape.getMemberName())); + variables.put( + "fieldType", + rustTypeForShape(model.expectShape(memberShape.getTarget())) + ); + return variables; + } + + // Currently only handles simple types and enums, and doesn't account for any traits + private String rustTypeForShape(final Shape shape) { + return switch (shape.getType()) { + case BOOLEAN -> "::std::primitive::bool"; + // integral + case BYTE -> "::std::primitive::i8"; + case SHORT -> "::std::primitive::i16"; + case INTEGER -> "::std::primitive::i32"; + case LONG -> "::std::primitive::i64"; + // floats + case FLOAT -> "::std::primitive::f32"; + case DOUBLE -> "::std::primitive::f64"; + // special numerics + case BIG_INTEGER -> "::num::bigint::BigInt"; + case BIG_DECIMAL -> "::num::rational::BigRational"; + // special collections + case BLOB -> "::aws_smithy_types::Blob"; + case STRING -> { + //noinspection deprecation + if (shape.hasTrait(EnumTrait.class)) { + yield qualifiedRustEnumType( + ModelUtils.stringToEnumShape(shape.asStringShape().orElseThrow()) + ); + } + yield "::std::string::String"; + } + case ENUM -> qualifiedRustEnumType(shape.asEnumShape().orElseThrow()); + // everything else + case TIMESTAMP -> "::aws_smithy_types::DateTime"; + // TODO: list, map, structure, union + default -> throw new UnsupportedOperationException( + "Unsupported shape type: " + shape.getType() + ); + }; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ModelUtils.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ModelUtils.java index 47e50c734..0795b6a8c 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ModelUtils.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ModelUtils.java @@ -110,6 +110,36 @@ public static Stream streamNamespaceErrors( ); } + /** + * Returns a stream of enum shapes in the given namespace. + * These include both Smithy v2 enums, + * and Smithy v1 @enum strings converted to {@link EnumShape}s. + */ + public static Stream streamEnumShapes( + final Model model, + final String namespace + ) { + @SuppressWarnings("deprecation") + final Stream v1Enums = model + .getStringShapesWithTrait(EnumTrait.class) + .stream() + .map(ModelUtils::stringToEnumShape); + final Stream v2Enums = model.getEnumShapes().stream(); + return Stream + .concat(v1Enums, v2Enums) + .filter(shape -> shape.getId().getNamespace().equals(namespace)); + } + + public static EnumShape stringToEnumShape(final StringShape stringShape) { + return EnumShape + .fromStringShape(stringShape) + .orElseThrow(() -> + new UnsupportedOperationException( + "Could not convert %s to an enum".formatted(stringShape.getId()) + ) + ); + } + /** * @return true if the given shape ID is in the given service's namespace */ diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/operation.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/operation.rs index 874db88a8..9919295c4 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/operation.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/conversions/operation.rs @@ -25,6 +25,6 @@ pub fn from_dafny_error( } } -pub mod _$snakeCaseOperationInputName:L; +pub mod _$snakeCaseSyntheticOperationInputName:L; -pub mod _$snakeCaseOperationOutputName:L; \ No newline at end of file +pub mod _$snakeCaseSyntheticOperationOutputName:L; \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/outer.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/outer.rs index 5d5817d73..0aea337ee 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/outer.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/operation/outer.rs @@ -14,7 +14,7 @@ impl $operationName:L { crate::operation::$snakeCaseOperationName:L::$operationOutputName:L, crate::operation::$snakeCaseOperationName:L::$operationErrorName:L, > { - let inner_input = crate::conversions::$snakeCaseOperationName:L::_$snakeCaseOperationInputName:L::to_dafny(input); + let inner_input = crate::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationInputName:L::to_dafny(input); let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()).$operationName:L(&inner_input); if matches!( @@ -22,7 +22,7 @@ impl $operationName:L { crate::r#_Wrappers_Compile::Result::Success { .. } ) { Ok( - crate::conversions::$snakeCaseOperationName:L::_$snakeCaseOperationOutputName:L::from_dafny( + crate::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationOutputName:L::from_dafny( inner_result.value().clone(), ), ) diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/src/standard_library_externs.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 000000000..eca6a2980 --- /dev/null +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::UTF8; + +impl crate::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types.rs index 2627a01b4..94630df9d 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types.rs @@ -1,2 +1,4 @@ /// Types for the `$configName:L` -pub mod $snakeCaseConfigName:L; \ No newline at end of file +pub mod $snakeCaseConfigName:L; + +$enumModules:L \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/enum.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/enum.rs new file mode 100644 index 000000000..0c74b9c52 --- /dev/null +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/types/enum.rs @@ -0,0 +1,12 @@ +#[derive(Debug, PartialEq, Copy, Clone)] +pub enum $rustEnumName:L { + $variants:L +} + +impl ::std::fmt::Display for $rustEnumName:L { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + $displayVariants:L + } + } +} \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped/client_operation_impl.part.rs b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped/client_operation_impl.part.rs index ce6976a53..ad3ac5afc 100644 --- a/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped/client_operation_impl.part.rs +++ b/codegen/smithy-dafny-codegen/src/main/resources/templates/runtimes/rust/wrapped/client_operation_impl.part.rs @@ -12,7 +12,7 @@ >, >{ let inner_input = - crate::conversions::$snakeCaseOperationName:L::_$snakeCaseOperationInputName:L::from_dafny(input.clone()); + crate::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationInputName:L::from_dafny(input.clone()); let result = self.rt.block_on(crate::operation::$snakeCaseOperationName:L::$operationName:L::send(&self.wrapped, inner_input)); match result { Err(error) => ::std::rc::Rc::new( @@ -22,7 +22,7 @@ ), Ok(client) => ::std::rc::Rc::new( crate::_Wrappers_Compile::Result::Success { - value: crate::conversions::$snakeCaseOperationName:L::_$snakeCaseOperationOutputName:L::to_dafny(client), + value: crate::conversions::$snakeCaseOperationName:L::_$snakeCaseSyntheticOperationOutputName:L::to_dafny(client), }, ), } From dfca8d9d318114fa7ad43b383e223c682dd49200 Mon Sep 17 00:00:00 2001 From: Andrew Jewell <107044381+ajewellamz@users.noreply.github.com> Date: Tue, 3 Sep 2024 12:08:39 -0400 Subject: [PATCH 2/4] fix: bump Rust version to 1.80 (#553) * fix: bump Rust version to 1.80 --- .github/workflows/test_models_rust_tests.yml | 2 +- TestModels/Errors/runtimes/rust/Cargo.toml | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_models_rust_tests.yml b/.github/workflows/test_models_rust_tests.yml index 5d0175142..7833df745 100644 --- a/.github/workflows/test_models_rust_tests.yml +++ b/.github/workflows/test_models_rust_tests.yml @@ -59,7 +59,7 @@ jobs: - name: Set up Rust uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: "1.76.0" + toolchain: "1.80.0" rustflags: "" components: rustfmt diff --git a/TestModels/Errors/runtimes/rust/Cargo.toml b/TestModels/Errors/runtimes/rust/Cargo.toml index 9434c16e4..b14b9e9ec 100644 --- a/TestModels/Errors/runtimes/rust/Cargo.toml +++ b/TestModels/Errors/runtimes/rust/Cargo.toml @@ -6,12 +6,10 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +aws-smithy-runtime = {version = "1.7.1", features=["client"]} +aws-smithy-runtime-api = {version = "1.7.2", features=["client"]} +aws-smithy-types = "1.2.4" dafny_runtime = { path = "../../../dafny-dependencies/dafny_runtime_rust"} -[dependencies.aws-smithy-runtime] -features = ["client"] -[dependencies.aws-smithy-runtime-api] -features = ["client"] -[dependencies.aws-smithy-types] [dev-dependencies.tokio] version = "1.26.0" From 17425b1564466c58eda085e9e91399a6bdeced34 Mon Sep 17 00:00:00 2001 From: Robin Salkeld Date: Tue, 3 Sep 2024 13:56:49 -0700 Subject: [PATCH 3/4] chore(ci): make all pull.yml jobs required in branch protection automatically (#554) As is the case for many suites of GitHub actions, it's a huge pain to manually maintain the list of required checks in the branch protection. This change leverages https://github.com/re-actors/alls-green to add a single capstone action that only passes if all dependent jobs pass (see repo README for details on why the naive approach doesn't work). Once this is approved I'll update the required checks before merging. Also adding Python tests to the list of triggers in the nightly build since I noticed it was missing. --- .github/workflows/nightly_dafny.yml | 1 + .github/workflows/pull.yml | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/nightly_dafny.yml b/.github/workflows/nightly_dafny.yml index 4edb7ab15..20b5baa2b 100644 --- a/.github/workflows/nightly_dafny.yml +++ b/.github/workflows/nightly_dafny.yml @@ -50,6 +50,7 @@ jobs: dafny-nightly-java, dafny-nightly-net, dafny-nightly-rust, + dafny-nightly-python, ] if: ${{ always() && contains(needs.*.result, 'failure') }} env: diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 7ee82eede..31e2db4db 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -66,3 +66,18 @@ jobs: uses: ./.github/workflows/test_models_python_tests.yml with: dafny: ${{ matrix.dafny-version }} + + pr-ci-all-required: + if: always() + needs: + - pr-ci-verification + - pr-ci-java + - pr-ci-net + - pr-ci-rust + - pr-ci-python + runs-on: ubuntu-latest + steps: + - name: Verify all required jobs passed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} From 3c0a1ce5736fb4de5faf0d8067e8dc7cf93839fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Corella?= <39066999+josecorella@users.noreply.github.com> Date: Tue, 3 Sep 2024 17:12:08 -0700 Subject: [PATCH 4/4] chore: add Dafny 4.8.0 (#522) --- .github/workflows/pull.yml | 4 ++-- .github/workflows/push.yml | 4 ++-- .../amazon/polymorph/smithyjava/ForEachDafnyTest.java | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 31e2db4db..eabedfa74 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -10,10 +10,10 @@ jobs: steps: - name: Populate Dafny versions list id: populate-dafny-versions-list - run: echo "dafny-versions-list=['4.2.0', '4.4.0']" >> $GITHUB_OUTPUT + run: echo "dafny-versions-list=['4.2.0', '4.4.0', '4.8.0']" >> $GITHUB_OUTPUT - name: Populate Dafny versions list for "only new versions" languages (Python) id: populate-only-new-dafny-versions-list - run: echo "only-new-dafny-versions-list=['4.7.0']" >> $GITHUB_OUTPUT + run: echo "only-new-dafny-versions-list=['4.8.0']" >> $GITHUB_OUTPUT outputs: dafny-version-list: ${{ steps.populate-dafny-versions-list.outputs.dafny-versions-list }} only-new-dafny-version-list: ${{ steps.populate-only-new-dafny-versions-list.outputs.only-new-dafny-versions-list }} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 43c1298b7..e3d69c219 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -12,10 +12,10 @@ jobs: steps: - name: Populate Dafny versions list id: populate-dafny-versions-list - run: echo "dafny-versions-list=['4.2.0', '4.4.0']" >> $GITHUB_OUTPUT + run: echo "dafny-versions-list=['4.2.0', '4.4.0', '4.8.0']" >> $GITHUB_OUTPUT - name: Populate Dafny versions list for "only new versions" languages (Python) id: populate-only-new-dafny-versions-list - run: echo "only-new-dafny-versions-list=['4.7.0']" >> $GITHUB_OUTPUT + run: echo "only-new-dafny-versions-list=['4.8.0']" >> $GITHUB_OUTPUT outputs: dafny-version-list: ${{ steps.populate-dafny-versions-list.outputs.dafny-versions-list }} only-new-dafny-version-list: ${{ steps.populate-only-new-dafny-versions-list.outputs.only-new-dafny-versions-list }} diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/ForEachDafnyTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/ForEachDafnyTest.java index 20ace96be..61f032a86 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/ForEachDafnyTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/ForEachDafnyTest.java @@ -17,6 +17,7 @@ public static Collection dafnies() { new Object[][] { { new DafnyVersion(4, 1, 0) }, { new DafnyVersion(4, 3, 0) }, + { new DafnyVersion(4, 8, 0) }, } ); }