From c2acbe8cd70b509b6abd1477c5ded4e2f47d38c7 Mon Sep 17 00:00:00 2001 From: Robin Salkeld Date: Mon, 19 Aug 2024 09:32:40 -0700 Subject: [PATCH] feat: Support externs in rust without patch files (#521) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dafny's `feat-rust` branch currently assumes all code is going into one crate. There are two options for adding additional Rust code that is manually-written (or generated from other sources :): 1. Pass the files as additional input files to `dafny`. 2. Post-process the output from `dafny` to declare the extra modules. #1 is cleaner, but requires that the Rust source files are not nested under folders to implicitly declare their ancestor modules. Since the design for Rust support so far has lots of these nested files, and we are hoping to eventually reuse the `smithy-rs` logic which generates such files, we're opting for #2 for now (although we do now use #1 for the StandardLibrary as a special case). Our approach so far has been to use patch files to add these extra declarations, but maintaining the patch files has been very painful in development, and we don't want to force `smithy-dafny` consumers to use them to create functional Rust libraries. Therefore this change adds automation to add the extra declarations. Since the extra declarations depend on the Smithy model, this is done in Java logic rather than Makefile or scripting. I've added an additional `patch-after-transpiling` command to the CLI, retroactively interpreting the existing single command as `generate`. The apache commons CLI library doesn't support this directly but it's pretty simple to handle subcommands ourselves. Also deleted all patch files for Rust. 🎉 Now test models can indicate they are benerated with `RUST_BENERATED=1` instead, which will make `make polymorph_rust` a no-op. Also fixed up the test models to work with the common set of declarations: some test models were missing their copy of `standard_library_conversions.rs`, and `Constructor` deviated from the config naming convention. --- SmithyDafnyMakefile.mk | 45 +- TestModels/Aggregate/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 3203 ----------------- .../rust/src/implementation_from_dafny.rs | 4 +- TestModels/Constructor/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 1415 -------- .../Constructor/runtimes/rust/src/client.rs | 2 +- .../_simple_constructor_config.rs | 6 +- .../rust/src/implementation_from_dafny.rs | 14 +- .../src/operation/get_constructor/builders.rs | 6 +- .../Constructor/runtimes/rust/src/types.rs | 4 + .../simple_constructor_config.rs} | 8 +- .../runtimes/rust/tests/constructor_test.rs | 4 +- TestModels/Refinement/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 2608 -------------- .../rust/src/implementation_from_dafny.rs | 5 +- TestModels/Resource/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 2016 ----------- .../rust/src/implementation_from_dafny.rs | 38 +- TestModels/SharedMakefile.mk | 7 +- TestModels/SimpleTypes/SimpleBlob/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 1569 -------- .../rust/src/implementation_from_dafny.rs | 4 +- TestModels/SimpleTypes/SimpleBoolean/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 1010 ------ .../rust/src/implementation_from_dafny.rs | 93 +- .../rust/src/standard_library_conversions.rs | 246 ++ TestModels/SimpleTypes/SimpleDouble/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 1019 ------ .../rust/src/implementation_from_dafny.rs | 4 +- TestModels/SimpleTypes/SimpleEnum/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 2519 ------------- .../rust/src/implementation_from_dafny.rs | 3 + .../rust/src/standard_library_conversions.rs | 246 ++ TestModels/SimpleTypes/SimpleEnumV2/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 2563 ------------- .../rust/src/implementation_from_dafny.rs | 4 + .../rust/src/standard_library_conversions.rs | 246 ++ TestModels/SimpleTypes/SimpleInteger/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 1291 ------- .../rust/src/implementation_from_dafny.rs | 4 + .../rust/src/standard_library_conversions.rs | 246 ++ TestModels/SimpleTypes/SimpleLong/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 1247 ------- .../rust/src/implementation_from_dafny.rs | 4 + .../rust/src/standard_library_conversions.rs | 246 ++ TestModels/SimpleTypes/SimpleShort/Makefile | 2 + TestModels/SimpleTypes/SimpleString/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 1822 ---------- .../rust/src/implementation_from_dafny.rs | 5 +- .../rust/src/standard_library_conversions.rs | 246 ++ .../SimpleTypes/SimpleTimestamp/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 737 ---- .../rust/src/implementation_from_dafny.rs | 5 +- .../rust/src/standard_library_conversions.rs | 246 ++ .../SimpleTypes/SimpleTimestamp/src/Index.dfy | 31 + TestModels/Union/Makefile | 2 + .../codegen-patches/rust/dafny-4.5.0.patch | 1525 -------- .../rust/src/implementation_from_dafny.rs | 4 + .../rust/src/standard_library_conversions.rs | 246 ++ .../StandardLibrary/Makefile | 18 +- .../runtimes/rust/src/UTF8_externs.rs | 90 +- .../runtimes/rust/src/conversion.rs | 77 +- .../rust/src/implementation_from_dafny.rs | 7 +- .../StandardLibrary/runtimes/rust/src/lib.rs | 4 - .../software/amazon/polymorph/CodegenCli.java | 136 +- .../polymorph/smithyrust/RustTestModels.java | 4 +- .../amazon/polymorph/CodegenEngine.java | 83 + 68 files changed, 2508 insertions(+), 24757 deletions(-) delete mode 100644 TestModels/Aggregate/codegen-patches/rust/dafny-4.5.0.patch delete mode 100644 TestModels/Constructor/codegen-patches/rust/dafny-4.5.0.patch create mode 100644 TestModels/Constructor/runtimes/rust/src/types.rs rename TestModels/Constructor/runtimes/rust/src/{config.rs => types/simple_constructor_config.rs} (95%) delete mode 100644 TestModels/Refinement/codegen-patches/rust/dafny-4.5.0.patch delete mode 100644 TestModels/Resource/codegen-patches/rust/dafny-4.5.0.patch delete mode 100644 TestModels/SimpleTypes/SimpleBlob/codegen-patches/rust/dafny-4.5.0.patch delete mode 100644 TestModels/SimpleTypes/SimpleBoolean/codegen-patches/rust/dafny-4.5.0.patch create mode 100644 TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/standard_library_conversions.rs delete mode 100644 TestModels/SimpleTypes/SimpleDouble/codegen-patches/rust/dafny-4.5.0.patch delete mode 100644 TestModels/SimpleTypes/SimpleEnum/codegen-patches/rust/dafny-4.5.0.patch create mode 100644 TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/standard_library_conversions.rs delete mode 100644 TestModels/SimpleTypes/SimpleEnumV2/codegen-patches/rust/dafny-4.5.0.patch create mode 100644 TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/standard_library_conversions.rs delete mode 100644 TestModels/SimpleTypes/SimpleInteger/codegen-patches/rust/dafny-4.5.0.patch create mode 100644 TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/standard_library_conversions.rs delete mode 100644 TestModels/SimpleTypes/SimpleLong/codegen-patches/rust/dafny-4.5.0.patch create mode 100644 TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/standard_library_conversions.rs delete mode 100644 TestModels/SimpleTypes/SimpleString/codegen-patches/rust/dafny-4.5.0.patch create mode 100644 TestModels/SimpleTypes/SimpleString/runtimes/rust/src/standard_library_conversions.rs delete mode 100644 TestModels/SimpleTypes/SimpleTimestamp/codegen-patches/rust/dafny-4.5.0.patch create mode 100644 TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/standard_library_conversions.rs create mode 100644 TestModels/SimpleTypes/SimpleTimestamp/src/Index.dfy delete mode 100644 TestModels/Union/codegen-patches/rust/dafny-4.5.0.patch create mode 100644 TestModels/Union/runtimes/rust/src/standard_library_conversions.rs delete mode 100644 TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/lib.rs diff --git a/SmithyDafnyMakefile.mk b/SmithyDafnyMakefile.mk index 4ed381c43..056d1c8e8 100644 --- a/SmithyDafnyMakefile.mk +++ b/SmithyDafnyMakefile.mk @@ -202,6 +202,7 @@ transpile_implementation: -useRuntimeLib \ -out $(OUT) \ $(DAFNY_OPTIONS) \ + $(DAFNY_OTHER_FILES) \ $(if $(strip $(STD_LIBRARY)) , -library:$(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy, ) \ $(TRANSPILE_DEPENDENCIES) @@ -243,6 +244,7 @@ transpile_test: -useRuntimeLib \ -out $(OUT) \ $(DAFNY_OPTIONS) \ + $(DAFNY_OTHER_FILES) \ $(if $(strip $(STD_LIBRARY)) , -library:$(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy, ) \ $(TRANSPILE_DEPENDENCIES) \ @@ -417,7 +419,10 @@ polymorph_rust: done _polymorph_rust: OUTPUT_RUST=--output-rust $(LIBRARY_ROOT)/runtimes/rust -_polymorph_rust: _polymorph +# For several TestModels we've just manually written the code generation target, +# So we just want to ensure we can transpile and pass the tests in CI. +# For those, make polymorph_rust should just be a no-op. +_polymorph_rust: $(if $(RUST_BENERATED), , _polymorph) ########################## .NET targets @@ -533,26 +538,42 @@ transpile_implementation_rust: TRANSPILE_DEPENDENCIES= transpile_implementation_rust: STD_LIBRARY= transpile_implementation_rust: SRC_INDEX_TRANSPILE=$(if $(SRC_INDEX),$(SRC_INDEX),src) transpile_implementation_rust: TEST_INDEX_TRANSPILE=$(if $(TEST_INDEX),$(TEST_INDEX),test) -transpile_implementation_rust: $(if $(TRANSPILE_TESTS_IN_RUST), transpile_test, transpile_implementation) _mv_implementation_rust +transpile_implementation_rust: DAFNY_OTHER_FILES=$(RUST_OTHER_FILES) +transpile_implementation_rust: $(if $(TRANSPILE_TESTS_IN_RUST), transpile_test, transpile_implementation) _mv_implementation_rust patch_after_transpile_rust transpile_dependencies_rust: LANG=rust transpile_dependencies_rust: transpile_dependencies -_mv_implementation_rust: RUST_EXTERN_MODULE_DECLARATIONS=$(if $(AWS_SDK_CMD), \ -mod client; \ -mod conversions; \ -mod standard_library_conversions;, ) _mv_implementation_rust: mkdir -p runtimes/rust/src -# Dafny-generated code assumes its output will be the main library file, -# so we need to splice in module declarations for any extern code. - $(if $(AWS_SDK_CMD), \ - python3 -c "import sys; data = sys.stdin.buffer.read(); sys.stdout.buffer.write(data.replace(b'\npub mod', b'\n$(RUST_EXTERN_MODULE_DECLARATIONS)\n\npub mod', 1) if b'\npub mod' in data else data)" \ - < implementation_from_dafny-rust/src/implementation_from_dafny.rs > runtimes/rust/src/implementation_from_dafny.rs, \ - mv implementation_from_dafny-rust/src/implementation_from_dafny.rs runtimes/rust/src/implementation_from_dafny.rs) + mv implementation_from_dafny-rust/src/implementation_from_dafny.rs runtimes/rust/src/implementation_from_dafny.rs rustfmt runtimes/rust/src/implementation_from_dafny.rs rm -rf implementation_from_dafny-rust +patch_after_transpile_rust: + set -e; for service in $(PROJECT_SERVICES) ; do \ + export service_deps_var=SERVICE_DEPS_$${service} ; \ + export namespace_var=SERVICE_NAMESPACE_$${service} ; \ + export SERVICE=$${service} ; \ + $(MAKE) _patch_after_transpile_rust ; \ + done + +_patch_after_transpile_rust: OUTPUT_RUST=--output-rust $(LIBRARY_ROOT)/runtimes/rust +_patch_after_transpile_rust: + cd $(CODEGEN_CLI_ROOT); \ + ./../gradlew run --args="\ + patch-after-transpile \ + --dafny-version $(DAFNY_VERSION) \ + --library-root $(LIBRARY_ROOT) \ + $(OUTPUT_RUST) \ + --model $(if $(DIR_STRUCTURE_V2), $(LIBRARY_ROOT)/dafny/$(SERVICE)/Model, $(SMITHY_MODEL_ROOT)) \ + --dependent-model $(PROJECT_ROOT)/$(SMITHY_DEPS) \ + $(patsubst %, --dependent-model $(PROJECT_ROOT)/%/Model, $($(service_deps_var))) \ + --namespace $($(namespace_var)) \ + $(AWS_SDK_CMD) \ + $(POLYMORPH_OPTIONS) \ + "; + build_rust: cd runtimes/rust; \ cargo build diff --git a/TestModels/Aggregate/Makefile b/TestModels/Aggregate/Makefile index 35b2c325e..01472b7c1 100644 --- a/TestModels/Aggregate/Makefile +++ b/TestModels/Aggregate/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../SharedMakefile.mk PROJECT_SERVICES := \ diff --git a/TestModels/Aggregate/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/Aggregate/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index d66e89fb1..000000000 --- a/TestModels/Aggregate/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,3203 +0,0 @@ -diff --git b/TestModels/Aggregate/runtimes/rust/src/client.rs a/TestModels/Aggregate/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..787630d2 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/client.rs -@@ -0,0 +1,43 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ pub fn from_conf( -+ conf: crate::types::simple_aggregate_config::SimpleAggregateConfig, -+ ) -> Result { -+ // If this service had any configuration properties, -+ // they would need converting here too. -+ let inner = -+ crate::simple::aggregate::internaldafny::_default::SimpleAggregate( -+ &crate::conversions::simple_aggregate_config::_simple_aggregate_config::to_dafny( -+ conf, -+ ), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+mod get_aggregate; -+ -+mod get_aggregate_known_value_test; -diff --git b/TestModels/Aggregate/runtimes/rust/src/client/get_aggregate.rs a/TestModels/Aggregate/runtimes/rust/src/client/get_aggregate.rs -new file mode 100644 -index 00000000..a9f2e90b ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/client/get_aggregate.rs -@@ -0,0 +1,15 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetAggregate`](crate::operation::get_aggregate::builders::GetAggregateFluentBuilder) operation. -+ /// -+ /// - The fluent builder is configurable: -+ /// - [`value(impl Into>)`](crate::operation::get_aggregate::builders::GetAggregateFluentBuilder::name) / [`set_name(Option)`](crate::operation::get_aggregate::builders::GetAggregateFluentBuilder::set_name):(undocumented)
-+ /// - On success, responds with [`GetAggregateOutput`](crate::operation::get_aggregate::GetAggregateOutput) with field(s): -+ /// - [`value(Option)`](crate::operation::get_aggregate::GetAggregateOutput::value): (undocumented) -+ /// - On failure, responds with [`SdkError`](crate::operation::get_aggregate::GetAggregateError) -+ pub fn get_aggregate( -+ &self, -+ ) -> crate::operation::get_aggregate::builders::GetAggregateFluentBuilder { -+ crate::operation::get_aggregate::builders::GetAggregateFluentBuilder::new(self.clone()) -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/client/get_aggregate_known_value_test.rs a/TestModels/Aggregate/runtimes/rust/src/client/get_aggregate_known_value_test.rs -new file mode 100644 -index 00000000..f524733e ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/client/get_aggregate_known_value_test.rs -@@ -0,0 +1,17 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetAggregateKnownValueTest`](crate::operation::get_aggregate_known_value::builders::GetAggregateKnownValueTestFluentBuilder) operation. -+ /// -+ /// - The fluent builder is configurable: -+ /// - [`value(impl Into>)`](crate::operation::get_aggregate_known_value::builders::GetAggregateKnownValueTestFluentBuilder::name) / [`set_name(Option)`](crate::operation::get_aggregate_known_value::builders::GetAggregateKnownValueTestFluentBuilder::set_name):(undocumented)
-+ /// - On success, responds with [`GetAggregateKnownValueTestOutput`](crate::operation::get_aggregate_known_value::GetAggregateKnownValueTestOutput) with field(s): -+ /// - [`value(Option)`](crate::operation::get_aggregate_known_value::GetAggregateKnownValueTestOutput::value): (undocumented) -+ /// - On failure, responds with [`SdkError`](crate::operation::get_aggregate_known_value::GetAggregateKnownValueTestError) -+ pub fn get_aggregate_known_value_test( -+ &self, -+ ) -> crate::operation::get_aggregate_known_value_test::builders::GetAggregateKnownValueTestFluentBuilder{ -+ crate::operation::get_aggregate_known_value_test::builders::GetAggregateKnownValueTestFluentBuilder::new( -+ self.clone(), -+ ) -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/conversions.rs a/TestModels/Aggregate/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..b5acb2be ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/conversions.rs -@@ -0,0 +1,10 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_aggregate; -+ -+pub mod get_aggregate_known_value_test; -+ -+pub mod simple_aggregate_config; -+ -+pub mod nested_structure; -+pub mod string_structure; -+pub mod structure_list_element; -diff --git b/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate.rs a/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate.rs -new file mode 100644 -index 00000000..e2b2ff74 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate.rs -@@ -0,0 +1,32 @@ -+// 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_aggregate::GetAggregateError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_aggregate::GetAggregateError::Unhandled(unhandled) => -+ ::std::rc::Rc::new(crate::r#simple::aggregate::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::aggregate::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_aggregate::GetAggregateError { -+ // 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::aggregate::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_aggregate::GetAggregateError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_aggregate::GetAggregateError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_aggregate_input; -+ -+pub mod _get_aggregate_output; -diff --git b/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate/_get_aggregate_input.rs a/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate/_get_aggregate_input.rs -new file mode 100644 -index 00000000..3e95555f ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate/_get_aggregate_input.rs -@@ -0,0 +1,121 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::operation::get_aggregate::GetAggregateInput, -+) -> ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::GetAggregateInput, -+> { -+ ::std::rc::Rc::new(crate::r#simple::aggregate::internaldafny::types::GetAggregateInput::GetAggregateInput { -+ simpleStringList: -+ ::std::rc::Rc::new( -+ match value.simple_string_list() { -+ Some(val) => -+ crate::r#_Wrappers_Compile::Option::Some { -+ value : ::dafny_runtime::Sequence::from_array( -+ &val.iter().map(|x| -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&x)) -+ .collect() -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None{} -+ } -+ ), -+ -+ structureList: -+ ::std::rc::Rc::new( -+ match value.structure_list() { -+ Some(val) => -+ crate::r#_Wrappers_Compile::Option::Some { -+ value : ::dafny_runtime::Sequence::from_array( -+ &val.iter().map(|x| -+ crate::conversions::structure_list_element::to_dafny(x.clone())) -+ .collect() -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None{} -+ } -+ ), -+ -+ simpleStringMap: ::std::rc::Rc::new(match value.simple_string_map() { -+ Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : -+ ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), -+ |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None {} -+ }), -+ simpleIntegerMap: ::std::rc::Rc::new(match value.simple_integer_map() { -+ Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : -+ ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), -+ |v| *v, -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None {} -+ }), -+ nestedStructure: crate::conversions::nested_structure::option_to_dafny(value.nested_structure()) -+ }) -+} -+ -+// _get_aggregate_input.rs -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::GetAggregateInput, -+ >, -+) -> crate::operation::get_aggregate::GetAggregateInput { -+ match &*dafny_value { -+ crate::r#simple::aggregate::internaldafny::types::GetAggregateInput::GetAggregateInput { -+ simpleStringList, -+ structureList, -+ simpleStringMap, -+ simpleIntegerMap, -+ nestedStructure, -+ } => -+ crate::operation::get_aggregate::GetAggregateInput { -+ simple_string_list : match (&**simpleStringList).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&value, |x| -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&x)) -+ ), -+ _ => None -+ }, -+ structure_list : match (&**structureList).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&value, |x| -+ crate::conversions::structure_list_element::plain_from_dafny(&x)) -+ ), -+ _ => None -+ }, -+ -+ simple_string_map : match (&**simpleStringMap).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&value, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&k), -+ |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&v), -+ ) -+ ), -+ _ => None -+ }, -+ -+ simple_integer_map : match (&**simpleIntegerMap).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&value, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&k), -+ |v| *v, -+ ) -+ ), -+ _ => None -+ }, -+ -+ nested_structure: crate::conversions::nested_structure::option_from_dafny(nestedStructure.clone()) -+ } -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate/_get_aggregate_output.rs a/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate/_get_aggregate_output.rs -new file mode 100644 -index 00000000..38af1aed ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate/_get_aggregate_output.rs -@@ -0,0 +1,121 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::operation::get_aggregate::GetAggregateOutput, -+) -> ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::GetAggregateOutput, -+> { -+ ::std::rc::Rc::new(crate::r#simple::aggregate::internaldafny::types::GetAggregateOutput::GetAggregateOutput { -+ simpleStringList: -+ ::std::rc::Rc::new( -+ match value.simple_string_list() { -+ Some(val) => -+ crate::r#_Wrappers_Compile::Option::Some { -+ value : ::dafny_runtime::Sequence::from_array( -+ &val.iter().map(|x| -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&x)) -+ .collect() -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None{} -+ } -+ ), -+ -+ structureList: -+ ::std::rc::Rc::new( -+ match value.structure_list() { -+ Some(val) => -+ crate::r#_Wrappers_Compile::Option::Some { -+ value : ::dafny_runtime::Sequence::from_array( -+ &val.iter().map(|x| -+ crate::conversions::structure_list_element::to_dafny(x.clone())) -+ .collect() -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None{} -+ } -+ ), -+ -+ simpleStringMap: ::std::rc::Rc::new(match value.simple_string_map() { -+ Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : -+ ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), -+ |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None {} -+ }), -+ simpleIntegerMap: ::std::rc::Rc::new(match value.simple_integer_map() { -+ Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : -+ ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), -+ |v| *v, -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None {} -+ }), -+ nestedStructure: crate::conversions::nested_structure::option_to_dafny(value.nested_structure()) -+ }) -+} -+ -+// _get_aggregate_output.rs -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::GetAggregateOutput, -+ >, -+) -> crate::operation::get_aggregate::GetAggregateOutput { -+ match &*dafny_value { -+ crate::r#simple::aggregate::internaldafny::types::GetAggregateOutput::GetAggregateOutput { -+ simpleStringList, -+ structureList, -+ simpleStringMap, -+ simpleIntegerMap, -+ nestedStructure, -+ } => -+ crate::operation::get_aggregate::GetAggregateOutput { -+ simple_string_list : match (&**simpleStringList).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&value, |x| -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&x)) -+ ), -+ _ => None -+ }, -+ structure_list : match (&**structureList).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&value, |x| -+ crate::conversions::structure_list_element::plain_from_dafny(&x)) -+ ), -+ _ => None -+ }, -+ -+ simple_string_map : match (&**simpleStringMap).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&value, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&k), -+ |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&v), -+ ) -+ ), -+ _ => None -+ }, -+ -+ simple_integer_map : match (&**simpleIntegerMap).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&value, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&k), -+ |v| *v, -+ ) -+ ), -+ _ => None -+ }, -+ -+ nested_structure: crate::conversions::nested_structure::option_from_dafny(nestedStructure.clone()) -+ } -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate_known_value_test.rs a/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate_known_value_test.rs -new file mode 100644 -index 00000000..b57c988a ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate_known_value_test.rs -@@ -0,0 +1,39 @@ -+// 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_aggregate_known_value_test::GetAggregateKnownValueTestError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestError::Unhandled( -+ unhandled, -+ ) => ::std::rc::Rc::new( -+ crate::r#simple::aggregate::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::aggregate::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestError { -+ // 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::aggregate::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_aggregate_known_value_test_input; -+ -+pub mod _get_aggregate_known_value_test_output; -diff --git b/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate_known_value_test/_get_aggregate_known_value_test_input.rs a/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate_known_value_test/_get_aggregate_known_value_test_input.rs -new file mode 100644 -index 00000000..abb3931c ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate_known_value_test/_get_aggregate_known_value_test_input.rs -@@ -0,0 +1,121 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestInput, -+) -> ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::GetAggregateInput, -+> { -+ ::std::rc::Rc::new(crate::r#simple::aggregate::internaldafny::types::GetAggregateInput::GetAggregateInput { -+ simpleStringList: -+ ::std::rc::Rc::new( -+ match value.simple_string_list() { -+ Some(val) => -+ crate::r#_Wrappers_Compile::Option::Some { -+ value : ::dafny_runtime::Sequence::from_array( -+ &val.iter().map(|x| -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&x)) -+ .collect() -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None{} -+ } -+ ), -+ -+ structureList: -+ ::std::rc::Rc::new( -+ match value.structure_list() { -+ Some(val) => -+ crate::r#_Wrappers_Compile::Option::Some { -+ value : ::dafny_runtime::Sequence::from_array( -+ &val.iter().map(|x| -+ crate::conversions::structure_list_element::to_dafny(x.clone())) -+ .collect() -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None{} -+ } -+ ), -+ -+ simpleStringMap: ::std::rc::Rc::new(match value.simple_string_map() { -+ Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : -+ ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), -+ |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None {} -+ }), -+ simpleIntegerMap: ::std::rc::Rc::new(match value.simple_integer_map() { -+ Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : -+ ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), -+ |v| *v, -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None {} -+ }), -+ nestedStructure: crate::conversions::nested_structure::option_to_dafny(value.nested_structure()) -+ }) -+} -+ -+// _get_aggregate_input.rs -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::GetAggregateInput, -+ >, -+) -> crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestInput { -+ match &*dafny_value { -+ crate::r#simple::aggregate::internaldafny::types::GetAggregateInput::GetAggregateInput { -+ simpleStringList, -+ structureList, -+ simpleStringMap, -+ simpleIntegerMap, -+ nestedStructure, -+ } => -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestInput { -+ simple_string_list : match (&**simpleStringList).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&value, |x| -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&x)) -+ ), -+ _ => None -+ }, -+ structure_list : match (&**structureList).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&value, |x| -+ crate::conversions::structure_list_element::plain_from_dafny(&x)) -+ ), -+ _ => None -+ }, -+ -+ simple_string_map : match (&**simpleStringMap).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&value, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&k), -+ |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&v), -+ ) -+ ), -+ _ => None -+ }, -+ -+ simple_integer_map : match (&**simpleIntegerMap).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&value, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&k), -+ |v| *v, -+ ) -+ ), -+ _ => None -+ }, -+ -+ nested_structure: crate::conversions::nested_structure::option_from_dafny(nestedStructure.clone()) -+ } -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate_known_value_test/_get_aggregate_known_value_test_output.rs a/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate_known_value_test/_get_aggregate_known_value_test_output.rs -new file mode 100644 -index 00000000..a25bad5f ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/conversions/get_aggregate_known_value_test/_get_aggregate_known_value_test_output.rs -@@ -0,0 +1,121 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestOutput, -+) -> ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::GetAggregateOutput, -+> { -+ ::std::rc::Rc::new(crate::r#simple::aggregate::internaldafny::types::GetAggregateOutput::GetAggregateOutput { -+ simpleStringList: -+ ::std::rc::Rc::new( -+ match value.simple_string_list() { -+ Some(val) => -+ crate::r#_Wrappers_Compile::Option::Some { -+ value : ::dafny_runtime::Sequence::from_array( -+ &val.iter().map(|x| -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&x)) -+ .collect() -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None{} -+ } -+ ), -+ -+ structureList: -+ ::std::rc::Rc::new( -+ match value.structure_list() { -+ Some(val) => -+ crate::r#_Wrappers_Compile::Option::Some { -+ value : ::dafny_runtime::Sequence::from_array( -+ &val.iter().map(|x| -+ crate::conversions::structure_list_element::to_dafny(x.clone())) -+ .collect() -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None{} -+ } -+ ), -+ -+ simpleStringMap: ::std::rc::Rc::new(match value.simple_string_map() { -+ Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : -+ ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), -+ |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None {} -+ }), -+ simpleIntegerMap: ::std::rc::Rc::new(match value.simple_integer_map() { -+ Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : -+ ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), -+ |v| *v, -+ ) -+ }, -+ None => crate::r#_Wrappers_Compile::Option::None {} -+ }), -+ nestedStructure: crate::conversions::nested_structure::option_to_dafny(value.nested_structure()) -+ }) -+} -+ -+// _get_aggregate_known_value_test_output.rs -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::GetAggregateOutput, -+ >, -+) -> crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestOutput { -+ match &*dafny_value { -+ crate::r#simple::aggregate::internaldafny::types::GetAggregateOutput::GetAggregateOutput { -+ simpleStringList, -+ structureList, -+ simpleStringMap, -+ simpleIntegerMap, -+ nestedStructure, -+ } => -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestOutput { -+ simple_string_list : match (&**simpleStringList).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&value, |x| -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&x)) -+ ), -+ _ => None -+ }, -+ structure_list : match (&**structureList).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&value, |x| -+ crate::conversions::structure_list_element::plain_from_dafny(&x)) -+ ), -+ _ => None -+ }, -+ -+ simple_string_map : match (&**simpleStringMap).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&value, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&k), -+ |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&v), -+ ) -+ ), -+ _ => None -+ }, -+ -+ simple_integer_map : match (&**simpleIntegerMap).as_ref() { -+ crate::r#_Wrappers_Compile::Option::Some { value } => -+ Some( -+ ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(&value, -+ |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&k), -+ |v| *v, -+ ) -+ ), -+ _ => None -+ }, -+ -+ nested_structure: crate::conversions::nested_structure::option_from_dafny(nestedStructure.clone()) -+ } -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/conversions/nested_structure.rs a/TestModels/Aggregate/runtimes/rust/src/conversions/nested_structure.rs -new file mode 100644 -index 00000000..1986a5bf ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/conversions/nested_structure.rs -@@ -0,0 +1,81 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::types::NestedStructure, -+) -> ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::NestedStructure, -+> { -+ ::std::rc::Rc::new(crate::r#simple::aggregate::internaldafny::types::NestedStructure::NestedStructure { -+ stringStructure: crate::conversions::string_structure::option_to_dafny(value.string_structure), -+}) -+} -+ -+pub fn to_dafny_plain( -+ value: &crate::types::NestedStructure, -+) -> crate::r#simple::aggregate::internaldafny::types::NestedStructure { -+ crate::r#simple::aggregate::internaldafny::types::NestedStructure::NestedStructure { -+ stringStructure: crate::conversions::string_structure::option_to_dafny(value.string_structure.clone()), -+} -+} -+ -+pub fn option_to_dafny( -+ value: Option<&crate::types::NestedStructure>, -+) -> ::std::rc::Rc< -+ crate::_Wrappers_Compile::Option< -+ ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::NestedStructure, -+ >, -+ >, -+> { -+ let inner = match value { -+ None => crate::_Wrappers_Compile::Option::None {}, -+ Some(x) => crate::_Wrappers_Compile::Option::Some { -+ value: ::std::rc::Rc::new(to_dafny_plain(x)), -+ }, -+ }; -+ ::std::rc::Rc::new(inner) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::NestedStructure, -+ >, -+) -> crate::types::NestedStructure { -+ match &*dafny_value { -+ crate::r#simple::aggregate::internaldafny::types::NestedStructure::NestedStructure { -+ stringStructure, -+ } => -+ crate::types::NestedStructure { -+ string_structure: crate::conversions::string_structure::option_from_dafny(stringStructure.clone()), -+ } -+ } -+} -+ -+#[allow(dead_code)] -+pub fn plain_from_dafny( -+ dafny_value: &crate::r#simple::aggregate::internaldafny::types::NestedStructure, -+) -> crate::types::NestedStructure { -+ match dafny_value { -+ crate::r#simple::aggregate::internaldafny::types::NestedStructure::NestedStructure { -+ stringStructure, -+ } => -+ crate::types::NestedStructure { -+ string_structure: crate::conversions::string_structure::option_from_dafny(stringStructure.clone()), -+ } -+ } -+} -+ -+#[allow(dead_code)] -+pub fn option_from_dafny( -+ dafny_value: ::std::rc::Rc>>, -+) -> Option { -+ match &*dafny_value { -+ crate::_Wrappers_Compile::Option::Some { value } => { -+ Some(plain_from_dafny(value)) -+ } -+ _ => None, -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/conversions/simple_aggregate_config.rs a/TestModels/Aggregate/runtimes/rust/src/conversions/simple_aggregate_config.rs -new file mode 100644 -index 00000000..177a7b2f ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/conversions/simple_aggregate_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_aggregate_config; -diff --git b/TestModels/Aggregate/runtimes/rust/src/conversions/simple_aggregate_config/_simple_aggregate_config.rs a/TestModels/Aggregate/runtimes/rust/src/conversions/simple_aggregate_config/_simple_aggregate_config.rs -new file mode 100644 -index 00000000..d8b4fce1 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/conversions/simple_aggregate_config/_simple_aggregate_config.rs -@@ -0,0 +1,21 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[allow(unused_variables)] -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::types::simple_aggregate_config::SimpleAggregateConfig, -+) -> ::std::rc::Rc< -+ crate::simple::aggregate::internaldafny::types::SimpleAggregateConfig, -+> { -+ ::std::rc::Rc::new(crate::r#simple::aggregate::internaldafny::types::SimpleAggregateConfig::SimpleAggregateConfig {}) -+} -+ -+#[allow(unused_variables)] -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::SimpleAggregateConfig, -+ >, -+) -> crate::types::simple_aggregate_config::SimpleAggregateConfig { -+ crate::types::simple_aggregate_config::SimpleAggregateConfig {} -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/conversions/string_structure.rs a/TestModels/Aggregate/runtimes/rust/src/conversions/string_structure.rs -new file mode 100644 -index 00000000..5f8502d3 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/conversions/string_structure.rs -@@ -0,0 +1,74 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::types::StringStructure, -+) -> ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::StringStructure, -+> { -+ ::std::rc::Rc::new(crate::r#simple::aggregate::internaldafny::types::StringStructure::StringStructure { -+ value: crate::standard_library_conversions::ostring_to_dafny(&value.value), -+}) -+} -+ -+pub fn to_dafny_plain( -+ value: crate::types::StringStructure, -+) -> crate::r#simple::aggregate::internaldafny::types::StringStructure { -+ crate::r#simple::aggregate::internaldafny::types::StringStructure::StringStructure { -+ value: crate::standard_library_conversions::ostring_to_dafny(&value.value), -+} -+} -+ -+pub fn option_to_dafny( -+ value: Option, -+) -> ::std::rc::Rc< -+ crate::_Wrappers_Compile::Option< -+ ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::StringStructure, -+ >, -+ >, -+> { -+ let inner = match value { -+ None => crate::_Wrappers_Compile::Option::None {}, -+ Some(x) => crate::_Wrappers_Compile::Option::Some { -+ value: ::std::rc::Rc::new(to_dafny_plain(x)), -+ }, -+ }; -+ ::std::rc::Rc::new(inner) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::StringStructure, -+ >, -+) -> crate::types::StringStructure { -+ plain_from_dafny(&*dafny_value) -+} -+ -+#[allow(dead_code)] -+pub fn plain_from_dafny( -+ dafny_value : &crate::r#simple::aggregate::internaldafny::types::StringStructure, -+) -> crate::types::StringStructure { -+ match dafny_value { -+ crate::r#simple::aggregate::internaldafny::types::StringStructure::StringStructure { -+ value, -+ } => -+ crate::types::StringStructure { -+ value: crate::standard_library_conversions::ostring_from_dafny(value.clone()), -+ } -+} -+} -+ -+#[allow(dead_code)] -+pub fn option_from_dafny( -+ dafny_value: ::std::rc::Rc>>, -+) -> Option { -+ match &*dafny_value { -+ crate::_Wrappers_Compile::Option::Some { value } => { -+ Some(plain_from_dafny(value)) -+ } -+ _ => None, -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/conversions/structure_list_element.rs a/TestModels/Aggregate/runtimes/rust/src/conversions/structure_list_element.rs -new file mode 100644 -index 00000000..1439b47a ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/conversions/structure_list_element.rs -@@ -0,0 +1,78 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::types::StructureListElement, -+) -> ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::StructureListElement, -+> { -+ ::std::rc::Rc::new(crate::r#simple::aggregate::internaldafny::types::StructureListElement::StructureListElement { -+ stringValue: crate::standard_library_conversions::ostring_to_dafny(&value.string_value), -+ integerValue: crate::standard_library_conversions::oint_to_dafny(value.integer_value), -+}) -+} -+ -+#[allow(dead_code)] -+pub fn to_dafny_plain( -+ value: crate::types::StructureListElement, -+) -> crate::r#simple::aggregate::internaldafny::types::StructureListElement { -+ crate::r#simple::aggregate::internaldafny::types::StructureListElement::StructureListElement { -+ stringValue: crate::standard_library_conversions::ostring_to_dafny(&value.string_value), -+ integerValue: crate::standard_library_conversions::oint_to_dafny(value.integer_value), -+} -+} -+ -+#[allow(dead_code)] -+pub fn option_to_dafny( -+ value: Option, -+) -> ::std::rc::Rc>>{ -+ let inner = match value { -+ None => crate::_Wrappers_Compile::Option::None {}, -+ Some(x) => crate::_Wrappers_Compile::Option::Some { -+ value: ::std::rc::Rc::new(to_dafny_plain(x)), -+ }, -+ }; -+ ::std::rc::Rc::new(inner) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::aggregate::internaldafny::types::StructureListElement, -+ >, -+) -> crate::types::StructureListElement { -+ plain_from_dafny(&*dafny_value) -+} -+ -+#[allow(dead_code)] -+pub fn plain_from_dafny( -+ dafny_value : &crate::r#simple::aggregate::internaldafny::types::StructureListElement, -+) -> crate::types::StructureListElement { -+ match dafny_value { -+ crate::r#simple::aggregate::internaldafny::types::StructureListElement::StructureListElement { -+ stringValue, -+ integerValue, -+ } => -+ crate::types::StructureListElement { -+ string_value: crate::standard_library_conversions::ostring_from_dafny(stringValue.clone()), -+ integer_value: crate::standard_library_conversions::oint_from_dafny(integerValue.clone()), -+ } -+} -+} -+ -+#[allow(dead_code)] -+pub fn option_from_dafny( -+ dafny_value: ::std::rc::Rc>>, -+) -> Option { -+ match &*dafny_value { -+ crate::_Wrappers_Compile::Option::Some { value } => { -+ Some(plain_from_dafny(value)) -+ } -+ _ => None, -+ } -+} -+ -+// structure_list_element.rs -diff --git b/TestModels/Aggregate/runtimes/rust/src/error.rs a/TestModels/Aggregate/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/Aggregate/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/Aggregate/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/Aggregate/runtimes/rust/src/implementation_from_dafny.rs -index e0fd087f..c76afa2b 100644 ---- b/TestModels/Aggregate/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/Aggregate/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,22 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+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; -+mod standard_library_conversions; -+ -+pub use client::Client; -+pub use types::simple_aggregate_config::SimpleAggregateConfig; -+ -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -diff --git b/TestModels/Aggregate/runtimes/rust/src/lib.rs a/TestModels/Aggregate/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..a2840f69 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/lib.rs -@@ -0,0 +1,19 @@ -+#![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_aggregate_config::SimpleAggregateConfig; -diff --git b/TestModels/Aggregate/runtimes/rust/src/operation.rs a/TestModels/Aggregate/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..4806430e ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/operation.rs -@@ -0,0 +1,7 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetAggregate` operation. -+pub mod get_aggregate; -+ -+/// Types for the `GetAggregateKnownValueTest` operation. -+pub mod get_aggregate_known_value_test; -diff --git b/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate.rs a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate.rs -new file mode 100644 -index 00000000..275313e4 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate.rs -@@ -0,0 +1,146 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetAggregate`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetAggregate; -+impl GetAggregate { -+ /// Creates a new `GetAggregate` -+ pub fn new() -> Self { -+ Self -+ } -+ -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_aggregate::GetAggregateInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_aggregate::GetAggregateOutput, -+ crate::operation::get_aggregate::GetAggregateError, -+ > { -+ let inner_input = crate::conversions::get_aggregate::_get_aggregate_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetAggregate(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_aggregate::_get_aggregate_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_aggregate::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetAggregateError` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetAggregateError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetAggregateError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetAggregateError { -+ /// Creates the `GetAggregateError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetAggregateError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetAggregateError { -+ 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 GetAggregateError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetAggregateError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetAggregateError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetAggregateError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_aggregate::_get_aggregate_output::GetAggregateOutput; -+ -+pub use crate::operation::get_aggregate::_get_aggregate_input::GetAggregateInput; -+ -+mod _get_aggregate_input; -+ -+mod _get_aggregate_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate/_get_aggregate_input.rs a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate/_get_aggregate_input.rs -new file mode 100644 -index 00000000..6b694dbb ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate/_get_aggregate_input.rs -@@ -0,0 +1,217 @@ -+// 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 GetAggregateInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub simple_string_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub structure_list: ::std::option::Option<::std::vec::Vec>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub simple_string_map: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ #[allow(missing_docs)] // documentation missing in model -+ pub simple_integer_map: -+ ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub nested_structure: ::std::option::Option, -+} -+impl GetAggregateInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_string_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { -+ &self.simple_string_list -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn structure_list(&self) -> &::std::option::Option<::std::vec::Vec> { -+ &self.structure_list -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_string_map( -+ &self, -+ ) -> ::std::option::Option< -+ &::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ > { -+ self.simple_string_map.as_ref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_integer_map( -+ &self, -+ ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, i32>> { -+ self.simple_integer_map.as_ref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn nested_structure(&self) -> ::std::option::Option<&crate::types::NestedStructure> { -+ self.nested_structure.as_ref() -+ } -+} -+impl GetAggregateInput { -+ /// Creates a new builder-style object to manufacture [`GetAggregateInput`](crate::operation::get_aggregate::GetAggregateInput). -+ pub fn builder() -> crate::operation::get_aggregate::builders::GetAggregateInputBuilder { -+ crate::operation::get_aggregate::builders::GetAggregateInputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetAggregateInput`](crate::operation::get_aggregate::GetAggregateInput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetAggregateInputBuilder { -+ pub(crate) simple_string_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ pub(crate) structure_list: -+ ::std::option::Option<::std::vec::Vec>, -+ pub(crate) simple_string_map: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ pub(crate) simple_integer_map: -+ ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ pub(crate) nested_structure: ::std::option::Option, -+} -+impl GetAggregateInputBuilder { -+ /// Appends an item to `simple_string_list`. -+ /// -+ /// To override the contents of this collection use [`set_simple_string_list`](Self::set_simple_string_list). -+ /// -+ pub fn simple_string_list( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ let mut v = self.simple_string_list.unwrap_or_default(); -+ v.push(input.into()); -+ self.simple_string_list = ::std::option::Option::Some(v); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_string_list( -+ mut self, -+ input: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ ) -> Self { -+ self.simple_string_list = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_string_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { -+ &self.simple_string_list -+ } -+ /// Appends an item to `structure_list`. -+ /// -+ /// To override the contents of this collection use [`set_structure_list`](Self::set_structure_list). -+ /// -+ pub fn structure_list(mut self, input: crate::types::StructureListElement) -> Self { -+ let mut v = self.structure_list.unwrap_or_default(); -+ v.push(input); -+ self.structure_list = ::std::option::Option::Some(v); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_structure_list( -+ mut self, -+ input: ::std::option::Option<::std::vec::Vec>, -+ ) -> Self { -+ self.structure_list = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_structure_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec> { -+ &self.structure_list -+ } -+ /// Adds a key-value pair to `simple_string_map`. -+ /// -+ /// To override the contents of this collection use [`set_simple_string_map`](Self::set_simple_string_map). -+ /// -+ pub fn simple_string_map( -+ mut self, -+ k: impl ::std::convert::Into<::std::string::String>, -+ v: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ let mut hash_map = self.simple_string_map.unwrap_or_default(); -+ hash_map.insert(k.into(), v.into()); -+ self.simple_string_map = ::std::option::Option::Some(hash_map); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_string_map( -+ mut self, -+ input: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ ) -> Self { -+ self.simple_string_map = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_string_map( -+ &self, -+ ) -> &::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ > { -+ &self.simple_string_map -+ } -+ /// Adds a key-value pair to `simple_integer_map`. -+ /// -+ /// To override the contents of this collection use [`set_simple_integer_map`](Self::set_simple_integer_map). -+ /// -+ pub fn simple_integer_map( -+ mut self, -+ k: impl ::std::convert::Into<::std::string::String>, -+ v: i32, -+ ) -> Self { -+ let mut hash_map = self.simple_integer_map.unwrap_or_default(); -+ hash_map.insert(k.into(), v); -+ self.simple_integer_map = ::std::option::Option::Some(hash_map); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_integer_map( -+ mut self, -+ input: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ ) -> Self { -+ self.simple_integer_map = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_integer_map( -+ &self, -+ ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, i32>> { -+ &self.simple_integer_map -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn nested_structure(mut self, input: crate::types::NestedStructure) -> Self { -+ self.nested_structure = ::std::option::Option::Some(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_nested_structure( -+ mut self, -+ input: ::std::option::Option, -+ ) -> Self { -+ self.nested_structure = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_nested_structure(&self) -> &::std::option::Option { -+ &self.nested_structure -+ } -+ /// Consumes the builder and constructs a [`GetAggregateInput`](crate::operation::get_aggregate::GetAggregateInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_aggregate::GetAggregateInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_aggregate::GetAggregateInput { -+ simple_string_list: self.simple_string_list, -+ structure_list: self.structure_list, -+ simple_string_map: self.simple_string_map, -+ simple_integer_map: self.simple_integer_map, -+ nested_structure: self.nested_structure, -+ }) -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate/_get_aggregate_output.rs a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate/_get_aggregate_output.rs -new file mode 100644 -index 00000000..7f97a2b6 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate/_get_aggregate_output.rs -@@ -0,0 +1,212 @@ -+// 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 GetAggregateOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub simple_string_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub structure_list: ::std::option::Option<::std::vec::Vec>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub simple_string_map: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ #[allow(missing_docs)] // documentation missing in model -+ pub simple_integer_map: -+ ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub nested_structure: ::std::option::Option, -+} -+impl GetAggregateOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_string_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { -+ &self.simple_string_list -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn structure_list(&self) -> &::std::option::Option<::std::vec::Vec> { -+ &self.structure_list -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_string_map( -+ &self, -+ ) -> ::std::option::Option< -+ &::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ > { -+ self.simple_string_map.as_ref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_integer_map( -+ &self, -+ ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, i32>> { -+ self.simple_integer_map.as_ref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn nested_structure(&self) -> ::std::option::Option<&crate::types::NestedStructure> { -+ self.nested_structure.as_ref() -+ } -+} -+impl GetAggregateOutput { -+ /// Creates a new builder-style object to manufacture [`GetAggregateOutput`](crate::operation::get_aggregate::GetAggregateOutput). -+ pub fn builder() -> crate::operation::get_aggregate::builders::GetAggregateOutputBuilder { -+ crate::operation::get_aggregate::builders::GetAggregateOutputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetAggregateOutput`](crate::operation::get_aggregate::GetAggregateOutput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetAggregateOutputBuilder { -+ pub(crate) simple_string_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ pub(crate) structure_list: -+ ::std::option::Option<::std::vec::Vec>, -+ pub(crate) simple_string_map: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ pub(crate) simple_integer_map: -+ ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ pub(crate) nested_structure: ::std::option::Option, -+} -+impl GetAggregateOutputBuilder { -+ /// Appends an item to `simple_string_list`. -+ /// -+ /// To override the contents of this collection use [`set_simple_string_list`](Self::set_simple_string_list). -+ /// -+ pub fn simple_string_list( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ let mut v = self.simple_string_list.unwrap_or_default(); -+ v.push(input.into()); -+ self.simple_string_list = ::std::option::Option::Some(v); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_string_list( -+ mut self, -+ input: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ ) -> Self { -+ self.simple_string_list = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_string_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { -+ &self.simple_string_list -+ } -+ /// Appends an item to `structure_list`. -+ /// -+ /// To override the contents of this collection use [`set_structure_list`](Self::set_structure_list). -+ /// -+ pub fn structure_list(mut self, input: crate::types::StructureListElement) -> Self { -+ let mut v = self.structure_list.unwrap_or_default(); -+ v.push(input); -+ self.structure_list = ::std::option::Option::Some(v); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_structure_list( -+ mut self, -+ input: ::std::option::Option<::std::vec::Vec>, -+ ) -> Self { -+ self.structure_list = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_structure_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec> { -+ &self.structure_list -+ } -+ /// Adds a key-value pair to `simple_string_map`. -+ /// -+ /// To override the contents of this collection use [`set_simple_string_map`](Self::set_simple_string_map). -+ /// -+ pub fn simple_string_map( -+ mut self, -+ k: impl ::std::convert::Into<::std::string::String>, -+ v: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ let mut hash_map = self.simple_string_map.unwrap_or_default(); -+ hash_map.insert(k.into(), v.into()); -+ self.simple_string_map = ::std::option::Option::Some(hash_map); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_string_map( -+ mut self, -+ input: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ ) -> Self { -+ self.simple_string_map = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_string_map( -+ &self, -+ ) -> &::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ > { -+ &self.simple_string_map -+ } -+ /// Adds a key-value pair to `simple_integer_map`. -+ /// -+ /// To override the contents of this collection use [`set_simple_integer_map`](Self::set_simple_integer_map). -+ /// -+ pub fn simple_integer_map( -+ mut self, -+ k: impl ::std::convert::Into<::std::string::String>, -+ v: i32, -+ ) -> Self { -+ let mut hash_map = self.simple_integer_map.unwrap_or_default(); -+ hash_map.insert(k.into(), v); -+ self.simple_integer_map = ::std::option::Option::Some(hash_map); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_integer_map( -+ mut self, -+ input: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ ) -> Self { -+ self.simple_integer_map = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_integer_map( -+ &self, -+ ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, i32>> { -+ &self.simple_integer_map -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn nested_structure(mut self, input: crate::types::NestedStructure) -> Self { -+ self.nested_structure = ::std::option::Option::Some(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_nested_structure( -+ mut self, -+ input: ::std::option::Option, -+ ) -> Self { -+ self.nested_structure = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_nested_structure(&self) -> &::std::option::Option { -+ &self.nested_structure -+ } -+ /// Consumes the builder and constructs a [`GetAggregateOutput`](crate::operation::get_aggregate::GetAggregateOutput). -+ pub fn build(self) -> crate::operation::get_aggregate::GetAggregateOutput { -+ crate::operation::get_aggregate::GetAggregateOutput { -+ simple_string_list: self.simple_string_list, -+ structure_list: self.structure_list, -+ simple_string_map: self.simple_string_map, -+ simple_integer_map: self.simple_integer_map, -+ nested_structure: self.nested_structure, -+ } -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate/builders.rs a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate/builders.rs -new file mode 100644 -index 00000000..a146e79b ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate/builders.rs -@@ -0,0 +1,189 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_aggregate::_get_aggregate_output::GetAggregateOutputBuilder; -+ -+pub use crate::operation::get_aggregate::_get_aggregate_input::GetAggregateInputBuilder; -+ -+impl GetAggregateInputBuilder { -+ /// 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_aggregate::GetAggregateOutput, -+ crate::operation::get_aggregate::GetAggregateError, -+ > { -+ let mut fluent_builder = client.get_aggregate(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+ -+/// Fluent builder constructing a request to `GetAggregate`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetAggregateFluentBuilder { -+ client: crate::Client, -+ inner: crate::operation::get_aggregate::builders::GetAggregateInputBuilder, -+} -+ -+impl GetAggregateFluentBuilder { -+ /// Creates a new `GetAggregateFluentBuilder`. -+ pub(crate) fn new(client: crate::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetAggregate as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_aggregate::builders::GetAggregateInputBuilder { -+ &self.inner -+ } -+ -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_aggregate::GetAggregateOutput, -+ crate::operation::get_aggregate::GetAggregateError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetAggregate 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_aggregate::GetAggregateError::unhandled)?; -+ crate::operation::get_aggregate::GetAggregate::send(&self.client, input).await -+ } -+ -+ /// -+ /// Appends an item to `simpleStringList`. -+ /// -+ /// To override the contents of this collection use [`set_simple_string_list`](Self::set_simple_string_list). -+ /// -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_string_list( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.inner = self.inner.simple_string_list(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_string_list( -+ mut self, -+ input: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ ) -> Self { -+ self.inner = self.inner.set_simple_string_list(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_string_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { -+ self.inner.get_simple_string_list() -+ } -+ /// -+ /// Appends an item to `structureList`. -+ /// -+ /// To override the contents of this collection use [`set_structure_list`](Self::set_structure_list). -+ /// -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn structure_list(mut self, input: crate::types::StructureListElement) -> Self { -+ self.inner = self.inner.structure_list(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_structure_list( -+ mut self, -+ input: ::std::option::Option<::std::vec::Vec>, -+ ) -> Self { -+ self.inner = self.inner.set_structure_list(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_structure_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec> { -+ self.inner.get_structure_list() -+ } -+ /// -+ /// Adds a key-value pair to `simpleStringMap`. -+ /// -+ /// To override the contents of this collection use [`set_simple_string_map`](Self::set_simple_string_map). -+ /// -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_string_map( -+ mut self, -+ k: impl ::std::convert::Into<::std::string::String>, -+ v: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.inner = self.inner.simple_string_map(k.into(), v.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_string_map( -+ mut self, -+ input: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ ) -> Self { -+ self.inner = self.inner.set_simple_string_map(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_string_map( -+ &self, -+ ) -> &::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ > { -+ self.inner.get_simple_string_map() -+ } -+ /// -+ /// Adds a key-value pair to `simpleIntegerMap`. -+ /// -+ /// To override the contents of this collection use [`set_simple_integer_map`](Self::set_simple_integer_map). -+ /// -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_integer_map( -+ mut self, -+ k: impl ::std::convert::Into<::std::string::String>, -+ v: i32, -+ ) -> Self { -+ self.inner = self.inner.simple_integer_map(k.into(), v); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_integer_map( -+ mut self, -+ input: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ ) -> Self { -+ self.inner = self.inner.set_simple_integer_map(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_integer_map( -+ &self, -+ ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, i32>> { -+ self.inner.get_simple_integer_map() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn nested_structure(mut self, input: crate::types::NestedStructure) -> Self { -+ self.inner = self.inner.nested_structure(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_nested_structure( -+ mut self, -+ input: ::std::option::Option, -+ ) -> Self { -+ self.inner = self.inner.set_nested_structure(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_nested_structure(&self) -> &::std::option::Option { -+ self.inner.get_nested_structure() -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate_known_value_test.rs a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate_known_value_test.rs -new file mode 100644 -index 00000000..bfbc7b95 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate_known_value_test.rs -@@ -0,0 +1,149 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetAggregateKnownValueTest`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetAggregateKnownValueTest; -+impl GetAggregateKnownValueTest { -+ /// Creates a new `GetAggregateKnownValueTest` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestOutput, -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestError, -+ > { -+ let inner_input = crate::conversions::get_aggregate_known_value_test::_get_aggregate_known_value_test_input::to_dafny(input); -+ let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()) -+ .GetAggregateKnownValueTest(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_aggregate_known_value_test::_get_aggregate_known_value_test_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err( -+ crate::conversions::get_aggregate_known_value_test::from_dafny_error( -+ inner_result.error().clone(), -+ ), -+ ) -+ } -+ } -+} -+ -+/// Error type for the `GetAggregateKnownValueTestError` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetAggregateKnownValueTestError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetAggregateKnownValueTestError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetAggregateKnownValueTestError { -+ /// Creates the `GetAggregateKnownValueTestError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetAggregateKnownValueTestError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetAggregateKnownValueTestError { -+ 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 GetAggregateKnownValueTestError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetAggregateKnownValueTestError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetAggregateKnownValueTestError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError -+ for GetAggregateKnownValueTestError -+{ -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_aggregate_known_value_test::_get_aggregate_known_value_test_output::GetAggregateKnownValueTestOutput; -+ -+pub use crate::operation::get_aggregate_known_value_test::_get_aggregate_known_value_test_input::GetAggregateKnownValueTestInput; -+ -+mod _get_aggregate_known_value_test_input; -+ -+mod _get_aggregate_known_value_test_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate_known_value_test/_get_aggregate_known_value_test_input.rs a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate_known_value_test/_get_aggregate_known_value_test_input.rs -new file mode 100644 -index 00000000..fd552e75 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate_known_value_test/_get_aggregate_known_value_test_input.rs -@@ -0,0 +1,219 @@ -+// 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 GetAggregateKnownValueTestInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub simple_string_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub structure_list: ::std::option::Option<::std::vec::Vec>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub simple_string_map: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ #[allow(missing_docs)] // documentation missing in model -+ pub simple_integer_map: -+ ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub nested_structure: ::std::option::Option, -+} -+impl GetAggregateKnownValueTestInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_string_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { -+ &self.simple_string_list -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn structure_list(&self) -> &::std::option::Option<::std::vec::Vec> { -+ &self.structure_list -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_string_map( -+ &self, -+ ) -> ::std::option::Option< -+ &::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ > { -+ self.simple_string_map.as_ref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_integer_map( -+ &self, -+ ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, i32>> { -+ self.simple_integer_map.as_ref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn nested_structure(&self) -> ::std::option::Option<&crate::types::NestedStructure> { -+ self.nested_structure.as_ref() -+ } -+} -+impl GetAggregateKnownValueTestInput { -+ /// Creates a new builder-style object to manufacture [`GetAggregateKnownValueTestInput`](crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestInput). -+ pub fn builder() -> crate::operation::get_aggregate_known_value_test::builders::GetAggregateKnownValueTestInputBuilder{ -+ crate::operation::get_aggregate_known_value_test::builders::GetAggregateKnownValueTestInputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetAggregateKnownValueTestInput`](crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestInput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetAggregateKnownValueTestInputBuilder { -+ pub(crate) simple_string_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ pub(crate) structure_list: -+ ::std::option::Option<::std::vec::Vec>, -+ pub(crate) simple_string_map: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ pub(crate) simple_integer_map: -+ ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ pub(crate) nested_structure: ::std::option::Option, -+} -+impl GetAggregateKnownValueTestInputBuilder { -+ /// Appends an item to `simple_string_list`. -+ /// -+ /// To override the contents of this collection use [`set_simple_string_list`](Self::set_simple_string_list). -+ /// -+ pub fn simple_string_list( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ let mut v = self.simple_string_list.unwrap_or_default(); -+ v.push(input.into()); -+ self.simple_string_list = ::std::option::Option::Some(v); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_string_list( -+ mut self, -+ input: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ ) -> Self { -+ self.simple_string_list = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_string_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { -+ &self.simple_string_list -+ } -+ /// Appends an item to `structure_list`. -+ /// -+ /// To override the contents of this collection use [`set_structure_list`](Self::set_structure_list). -+ /// -+ pub fn structure_list(mut self, input: crate::types::StructureListElement) -> Self { -+ let mut v = self.structure_list.unwrap_or_default(); -+ v.push(input); -+ self.structure_list = ::std::option::Option::Some(v); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_structure_list( -+ mut self, -+ input: ::std::option::Option<::std::vec::Vec>, -+ ) -> Self { -+ self.structure_list = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_structure_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec> { -+ &self.structure_list -+ } -+ /// Adds a key-value pair to `simple_string_map`. -+ /// -+ /// To override the contents of this collection use [`set_simple_string_map`](Self::set_simple_string_map). -+ /// -+ pub fn simple_string_map( -+ mut self, -+ k: impl ::std::convert::Into<::std::string::String>, -+ v: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ let mut hash_map = self.simple_string_map.unwrap_or_default(); -+ hash_map.insert(k.into(), v.into()); -+ self.simple_string_map = ::std::option::Option::Some(hash_map); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_string_map( -+ mut self, -+ input: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ ) -> Self { -+ self.simple_string_map = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_string_map( -+ &self, -+ ) -> &::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ > { -+ &self.simple_string_map -+ } -+ /// Adds a key-value pair to `simple_integer_map`. -+ /// -+ /// To override the contents of this collection use [`set_simple_integer_map`](Self::set_simple_integer_map). -+ /// -+ pub fn simple_integer_map( -+ mut self, -+ k: impl ::std::convert::Into<::std::string::String>, -+ v: i32, -+ ) -> Self { -+ let mut hash_map = self.simple_integer_map.unwrap_or_default(); -+ hash_map.insert(k.into(), v); -+ self.simple_integer_map = ::std::option::Option::Some(hash_map); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_integer_map( -+ mut self, -+ input: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ ) -> Self { -+ self.simple_integer_map = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_integer_map( -+ &self, -+ ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, i32>> { -+ &self.simple_integer_map -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn nested_structure(mut self, input: crate::types::NestedStructure) -> Self { -+ self.nested_structure = ::std::option::Option::Some(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_nested_structure( -+ mut self, -+ input: ::std::option::Option, -+ ) -> Self { -+ self.nested_structure = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_nested_structure(&self) -> &::std::option::Option { -+ &self.nested_structure -+ } -+ /// Consumes the builder and constructs a [`GetAggregateKnownValueTestInput`](crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok( -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestInput { -+ simple_string_list: self.simple_string_list, -+ structure_list: self.structure_list, -+ simple_string_map: self.simple_string_map, -+ simple_integer_map: self.simple_integer_map, -+ nested_structure: self.nested_structure, -+ }, -+ ) -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate_known_value_test/_get_aggregate_known_value_test_output.rs a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate_known_value_test/_get_aggregate_known_value_test_output.rs -new file mode 100644 -index 00000000..56d10054 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate_known_value_test/_get_aggregate_known_value_test_output.rs -@@ -0,0 +1,214 @@ -+// 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 GetAggregateKnownValueTestOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub simple_string_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub structure_list: ::std::option::Option<::std::vec::Vec>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub simple_string_map: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ #[allow(missing_docs)] // documentation missing in model -+ pub simple_integer_map: -+ ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub nested_structure: ::std::option::Option, -+} -+impl GetAggregateKnownValueTestOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_string_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { -+ &self.simple_string_list -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn structure_list(&self) -> &::std::option::Option<::std::vec::Vec> { -+ &self.structure_list -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_string_map( -+ &self, -+ ) -> ::std::option::Option< -+ &::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ > { -+ self.simple_string_map.as_ref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_integer_map( -+ &self, -+ ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, i32>> { -+ self.simple_integer_map.as_ref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn nested_structure(&self) -> ::std::option::Option<&crate::types::NestedStructure> { -+ self.nested_structure.as_ref() -+ } -+} -+impl GetAggregateKnownValueTestOutput { -+ /// Creates a new builder-style object to manufacture [`GetAggregateKnownValueTestOutput`](crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestOutput). -+ pub fn builder() -> crate::operation::get_aggregate_known_value_test::builders::GetAggregateKnownValueTestOutputBuilder{ -+ crate::operation::get_aggregate_known_value_test::builders::GetAggregateKnownValueTestOutputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetAggregateKnownValueTestOutput`](crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestOutput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetAggregateKnownValueTestOutputBuilder { -+ pub(crate) simple_string_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ pub(crate) structure_list: -+ ::std::option::Option<::std::vec::Vec>, -+ pub(crate) simple_string_map: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ pub(crate) simple_integer_map: -+ ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ pub(crate) nested_structure: ::std::option::Option, -+} -+impl GetAggregateKnownValueTestOutputBuilder { -+ /// Appends an item to `simple_string_list`. -+ /// -+ /// To override the contents of this collection use [`set_simple_string_list`](Self::set_simple_string_list). -+ /// -+ pub fn simple_string_list( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ let mut v = self.simple_string_list.unwrap_or_default(); -+ v.push(input.into()); -+ self.simple_string_list = ::std::option::Option::Some(v); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_string_list( -+ mut self, -+ input: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ ) -> Self { -+ self.simple_string_list = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_string_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { -+ &self.simple_string_list -+ } -+ /// Appends an item to `structure_list`. -+ /// -+ /// To override the contents of this collection use [`set_structure_list`](Self::set_structure_list). -+ /// -+ pub fn structure_list(mut self, input: crate::types::StructureListElement) -> Self { -+ let mut v = self.structure_list.unwrap_or_default(); -+ v.push(input); -+ self.structure_list = ::std::option::Option::Some(v); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_structure_list( -+ mut self, -+ input: ::std::option::Option<::std::vec::Vec>, -+ ) -> Self { -+ self.structure_list = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_structure_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec> { -+ &self.structure_list -+ } -+ /// Adds a key-value pair to `simple_string_map`. -+ /// -+ /// To override the contents of this collection use [`set_simple_string_map`](Self::set_simple_string_map). -+ /// -+ pub fn simple_string_map( -+ mut self, -+ k: impl ::std::convert::Into<::std::string::String>, -+ v: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ let mut hash_map = self.simple_string_map.unwrap_or_default(); -+ hash_map.insert(k.into(), v.into()); -+ self.simple_string_map = ::std::option::Option::Some(hash_map); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_string_map( -+ mut self, -+ input: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ ) -> Self { -+ self.simple_string_map = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_string_map( -+ &self, -+ ) -> &::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ > { -+ &self.simple_string_map -+ } -+ /// Adds a key-value pair to `simple_integer_map`. -+ /// -+ /// To override the contents of this collection use [`set_simple_integer_map`](Self::set_simple_integer_map). -+ /// -+ pub fn simple_integer_map( -+ mut self, -+ k: impl ::std::convert::Into<::std::string::String>, -+ v: i32, -+ ) -> Self { -+ let mut hash_map = self.simple_integer_map.unwrap_or_default(); -+ hash_map.insert(k.into(), v); -+ self.simple_integer_map = ::std::option::Option::Some(hash_map); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_integer_map( -+ mut self, -+ input: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ ) -> Self { -+ self.simple_integer_map = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_integer_map( -+ &self, -+ ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, i32>> { -+ &self.simple_integer_map -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn nested_structure(mut self, input: crate::types::NestedStructure) -> Self { -+ self.nested_structure = ::std::option::Option::Some(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_nested_structure( -+ mut self, -+ input: ::std::option::Option, -+ ) -> Self { -+ self.nested_structure = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_nested_structure(&self) -> &::std::option::Option { -+ &self.nested_structure -+ } -+ /// Consumes the builder and constructs a [`GetAggregateKnownValueTestOutput`](crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestOutput). -+ pub fn build( -+ self, -+ ) -> crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestOutput { -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestOutput { -+ simple_string_list: self.simple_string_list, -+ structure_list: self.structure_list, -+ simple_string_map: self.simple_string_map, -+ simple_integer_map: self.simple_integer_map, -+ nested_structure: self.nested_structure, -+ } -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate_known_value_test/builders.rs a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate_known_value_test/builders.rs -new file mode 100644 -index 00000000..63afa764 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/operation/get_aggregate_known_value_test/builders.rs -@@ -0,0 +1,192 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_aggregate_known_value_test::_get_aggregate_known_value_test_output::GetAggregateKnownValueTestOutputBuilder; -+ -+pub use crate::operation::get_aggregate_known_value_test::_get_aggregate_known_value_test_input::GetAggregateKnownValueTestInputBuilder; -+ -+impl GetAggregateKnownValueTestInputBuilder { -+ /// 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_aggregate_known_value_test::GetAggregateKnownValueTestOutput, -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestError, -+ > { -+ let mut fluent_builder = client.get_aggregate_known_value_test(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+ -+/// Fluent builder constructing a request to `GetAggregate`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetAggregateKnownValueTestFluentBuilder { -+ client: crate::Client, -+ inner: crate::operation::get_aggregate_known_value_test::builders::GetAggregateKnownValueTestInputBuilder, -+} -+ -+impl GetAggregateKnownValueTestFluentBuilder { -+ /// Creates a new `GetAggregateKnownValueTestFluentBuilder`. -+ pub(crate) fn new(client: crate::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetAggregateKnownValueTest as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_aggregate_known_value_test::builders::GetAggregateKnownValueTestInputBuilder{ -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestOutput, -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTestError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetAggregateKnownValueTest 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_aggregate_known_value_test::GetAggregateKnownValueTestError::unhandled)?; -+ crate::operation::get_aggregate_known_value_test::GetAggregateKnownValueTest::send( -+ &self.client, -+ input, -+ ) -+ .await -+ } -+ -+ /// -+ /// Appends an item to `simpleStringList`. -+ /// -+ /// To override the contents of this collection use [`set_simple_string_list`](Self::set_simple_string_list). -+ /// -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_string_list( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.inner = self.inner.simple_string_list(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_string_list( -+ mut self, -+ input: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -+ ) -> Self { -+ self.inner = self.inner.set_simple_string_list(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_string_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { -+ self.inner.get_simple_string_list() -+ } -+ /// -+ /// Appends an item to `structureList`. -+ /// -+ /// To override the contents of this collection use [`set_structure_list`](Self::set_structure_list). -+ /// -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn structure_list(mut self, input: crate::types::StructureListElement) -> Self { -+ self.inner = self.inner.structure_list(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_structure_list( -+ mut self, -+ input: ::std::option::Option<::std::vec::Vec>, -+ ) -> Self { -+ self.inner = self.inner.set_structure_list(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_structure_list( -+ &self, -+ ) -> &::std::option::Option<::std::vec::Vec> { -+ self.inner.get_structure_list() -+ } -+ /// -+ /// Adds a key-value pair to `simpleStringMap`. -+ /// -+ /// To override the contents of this collection use [`set_simple_string_map`](Self::set_simple_string_map). -+ /// -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_string_map( -+ mut self, -+ k: impl ::std::convert::Into<::std::string::String>, -+ v: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.inner = self.inner.simple_string_map(k.into(), v.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_string_map( -+ mut self, -+ input: ::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ >, -+ ) -> Self { -+ self.inner = self.inner.set_simple_string_map(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_string_map( -+ &self, -+ ) -> &::std::option::Option< -+ ::std::collections::HashMap<::std::string::String, ::std::string::String>, -+ > { -+ self.inner.get_simple_string_map() -+ } -+ /// -+ /// Adds a key-value pair to `simpleIntegerMap`. -+ /// -+ /// To override the contents of this collection use [`set_simple_integer_map`](Self::set_simple_integer_map). -+ /// -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn simple_integer_map( -+ mut self, -+ k: impl ::std::convert::Into<::std::string::String>, -+ v: i32, -+ ) -> Self { -+ self.inner = self.inner.simple_integer_map(k.into(), v); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_simple_integer_map( -+ mut self, -+ input: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>, -+ ) -> Self { -+ self.inner = self.inner.set_simple_integer_map(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_simple_integer_map( -+ &self, -+ ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, i32>> { -+ self.inner.get_simple_integer_map() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn nested_structure(mut self, input: crate::types::NestedStructure) -> Self { -+ self.inner = self.inner.nested_structure(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_nested_structure( -+ mut self, -+ input: ::std::option::Option, -+ ) -> Self { -+ self.inner = self.inner.set_nested_structure(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_nested_structure(&self) -> &::std::option::Option { -+ self.inner.get_nested_structure() -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/standard_library_conversions.rs a/TestModels/Aggregate/runtimes/rust/src/standard_library_conversions.rs -new file mode 100644 -index 00000000..2fec0ffb ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/standard_library_conversions.rs -@@ -0,0 +1,246 @@ -+pub fn ostring_to_dafny( -+ input: &Option, -+) -> ::std::rc::Rc< -+ 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 {}, -+}; -+ ::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>>, -+ >, -+) -> 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 -+ } -+} -+ -+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 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) -+} -+ -+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 -+ } -+} -+ -+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 blob_to_dafny( -+ input: &::aws_smithy_types::Blob, -+) -> ::dafny_runtime::Sequence { -+ ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) -+} -+ -+pub fn oblob_to_dafny( -+ 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) -+} -+ -+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>>, -+) -> Option<::aws_smithy_types::Blob> { -+ 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 odouble_to_dafny( -+ 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) -+} -+ -+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>>, -+) -> Option { -+ 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, -+) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { -+ ::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) -+} -+ -+pub fn timestamp_from_dafny( -+ 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() -+} -+ -+pub fn otimestamp_from_dafny( -+ input: ::std::rc::Rc>>, -+) -> Option<::aws_smithy_types::DateTime> { -+ 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, -+) -> Option { -+ 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, -+) -> ::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 {} -+ ), -+ } -+} -+ -+pub fn result_from_dafny( -+ 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)), -+ } -+} -+ -+pub fn result_to_dafny( -+ 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 -diff --git b/TestModels/Aggregate/runtimes/rust/src/types.rs a/TestModels/Aggregate/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..dd259ffa ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/types.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _nested_structure; -+pub mod _string_structure; -+pub mod _structure_list_element; -+pub mod builders; -+/// Types for the `SimpleAggregateConfig` -+pub mod simple_aggregate_config; -+ -+pub use crate::types::_nested_structure::NestedStructure; -+ -+pub use crate::types::_string_structure::StringStructure; -+ -+pub use crate::types::_structure_list_element::StructureListElement; -diff --git b/TestModels/Aggregate/runtimes/rust/src/types/_nested_structure.rs a/TestModels/Aggregate/runtimes/rust/src/types/_nested_structure.rs -new file mode 100644 -index 00000000..9f47bce0 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/types/_nested_structure.rs -@@ -0,0 +1,54 @@ -+// 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 NestedStructure { -+ #[allow(missing_docs)] // documentation missing in model -+ pub string_structure: ::std::option::Option, -+} -+impl NestedStructure { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn string_structure(&self) -> ::std::option::Option<&crate::types::StringStructure> { -+ self.string_structure.as_ref() -+ } -+} -+impl NestedStructure { -+ /// Creates a new builder-style object to manufacture [`NestedStructure`](crate::types::NestedStructure). -+ pub fn builder() -> crate::types::builders::NestedStructureBuilder { -+ crate::types::builders::NestedStructureBuilder::default() -+ } -+} -+ -+/// A builder for [`NestedStructure`](crate::types::NestedStructure). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct NestedStructureBuilder { -+ pub(crate) string_structure: ::std::option::Option, -+} -+impl NestedStructureBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn string_structure(mut self, input: crate::types::StringStructure) -> Self { -+ self.string_structure = ::std::option::Option::Some(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_string_structure( -+ mut self, -+ input: ::std::option::Option, -+ ) -> Self { -+ self.string_structure = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_aggregate_structure(&self) -> &::std::option::Option { -+ &self.string_structure -+ } -+ /// Consumes the builder and constructs a [`NestedStructure`](crate::types::NestedStructure). -+ pub fn build(self) -> crate::types::NestedStructure { -+ crate::types::NestedStructure { -+ string_structure: self.string_structure, -+ } -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/types/_string_structure.rs a/TestModels/Aggregate/runtimes/rust/src/types/_string_structure.rs -new file mode 100644 -index 00000000..8de473f4 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/types/_string_structure.rs -@@ -0,0 +1,49 @@ -+// 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 StringStructure { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option<::std::string::String>, -+} -+impl StringStructure { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option<&str> { -+ self.value.as_deref() -+ } -+} -+impl StringStructure { -+ /// Creates a new builder-style object to manufacture [`StringStructure`](crate::types::StringStructure). -+ pub fn builder() -> crate::types::builders::StringStructureBuilder { -+ crate::types::builders::StringStructureBuilder::default() -+ } -+} -+ -+/// A builder for [`StringStructure`](crate::types::StringStructure). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct StringStructureBuilder { -+ pub(crate) value: ::std::option::Option<::std::string::String>, -+} -+impl StringStructureBuilder { -+ #[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 [`StringStructure`](crate::types::StringStructure). -+ pub fn build(self) -> crate::types::StringStructure { -+ crate::types::StringStructure { value: self.value } -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/types/_structure_list_element.rs a/TestModels/Aggregate/runtimes/rust/src/types/_structure_list_element.rs -new file mode 100644 -index 00000000..7b3a42ff ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/types/_structure_list_element.rs -@@ -0,0 +1,73 @@ -+// 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 StructureListElement { -+ #[allow(missing_docs)] // documentation missing in model -+ pub string_value: ::std::option::Option<::std::string::String>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub integer_value: ::std::option::Option, -+} -+impl StructureListElement { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn string_value(&self) -> ::std::option::Option<&str> { -+ self.string_value.as_deref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn integer_value(&self) -> ::std::option::Option { -+ self.integer_value -+ } -+} -+impl StructureListElement { -+ /// Creates a new builder-style object to manufacture [`StructureListElement`](crate::types::StructureListElement). -+ pub fn builder() -> crate::types::builders::StructureListElementBuilder { -+ crate::types::builders::StructureListElementBuilder::default() -+ } -+} -+ -+/// A builder for [`StructureListElement`](crate::types::StructureListElement). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct StructureListElementBuilder { -+ pub(crate) string_value: ::std::option::Option<::std::string::String>, -+ pub(crate) integer_value: ::std::option::Option, -+} -+impl StructureListElementBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn string_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { -+ self.string_value = ::std::option::Option::Some(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_string_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { -+ self.string_value = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_aggregate_value(&self) -> &::std::option::Option<::std::string::String> { -+ &self.string_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn integer_value(mut self, input: i32) -> Self { -+ self.integer_value = ::std::option::Option::Some(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_integer_value(mut self, input: ::std::option::Option) -> Self { -+ self.integer_value = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_integer_value(&self) -> &::std::option::Option { -+ &self.integer_value -+ } -+ /// Consumes the builder and constructs a [`StructureListElement`](crate::types::StructureListElement). -+ pub fn build(self) -> crate::types::StructureListElement { -+ crate::types::StructureListElement { -+ string_value: self.string_value, -+ integer_value: self.integer_value, -+ } -+ } -+} -diff --git b/TestModels/Aggregate/runtimes/rust/src/types/builders.rs a/TestModels/Aggregate/runtimes/rust/src/types/builders.rs -new file mode 100644 -index 00000000..3d309b04 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/types/builders.rs -@@ -0,0 +1,6 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::types::_nested_structure::NestedStructureBuilder; -+ -+pub use crate::types::_string_structure::StringStructureBuilder; -+ -+pub use crate::types::_structure_list_element::StructureListElementBuilder; -diff --git b/TestModels/Aggregate/runtimes/rust/src/types/simple_aggregate_config.rs a/TestModels/Aggregate/runtimes/rust/src/types/simple_aggregate_config.rs -new file mode 100644 -index 00000000..d634c7c8 ---- /dev/null -+++ a/TestModels/Aggregate/runtimes/rust/src/types/simple_aggregate_config.rs -@@ -0,0 +1,28 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleAggregateConfig {} -+ -+impl SimpleAggregateConfig { -+ pub fn builder() -> SimpleAggregateConfigBuilder { -+ SimpleAggregateConfigBuilder::new() -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleAggregateConfigBuilder {} -+ -+impl SimpleAggregateConfigBuilder { -+ /// Creates a new `SimpleAggregateConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self {} -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ SimpleAggregateConfig, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(SimpleAggregateConfig {}) -+ } -+} diff --git a/TestModels/Aggregate/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/Aggregate/runtimes/rust/src/implementation_from_dafny.rs index c76afa2b3..2cdf85c27 100644 --- a/TestModels/Aggregate/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/Aggregate/runtimes/rust/src/implementation_from_dafny.rs @@ -13,10 +13,12 @@ pub mod operation; mod conversions; mod standard_library_conversions; +#[cfg(feature = "wrapped-client")] +pub mod wrapped; + pub use client::Client; pub use types::simple_aggregate_config::SimpleAggregateConfig; - pub mod r#_Wrappers_Compile { pub use dafny_runtime::DafnyPrint; pub use std::cmp::Eq; diff --git a/TestModels/Constructor/Makefile b/TestModels/Constructor/Makefile index 8a3081937..3191fcef7 100644 --- a/TestModels/Constructor/Makefile +++ b/TestModels/Constructor/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../SharedMakefile.mk NAMESPACE=simple.constructor diff --git a/TestModels/Constructor/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/Constructor/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index 127bdf1db..000000000 --- a/TestModels/Constructor/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,1415 +0,0 @@ -diff --git b/TestModels/Constructor/runtimes/rust/src/client.rs a/TestModels/Constructor/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..e209cced ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/client.rs -@@ -0,0 +1,36 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object, -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ pub fn from_conf(conf: crate::Config) -> Result { -+ let inner = -+ crate::r#simple::constructor::internaldafny::_default::SimpleConstructor( -+ &crate::conversions::simple_constructor_config::_simple_constructor_config::to_dafny(conf), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+mod get_constructor; -diff --git b/TestModels/Constructor/runtimes/rust/src/client/get_constructor.rs a/TestModels/Constructor/runtimes/rust/src/client/get_constructor.rs -new file mode 100644 -index 00000000..c1ec2593 ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/client/get_constructor.rs -@@ -0,0 +1,19 @@ -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetConstructor`](crate::operation::get_constructor::builders::GetConstructorFluentBuilder) operation. -+ /// -+ /// - The fluent builder is configurable: -+ /// - [`value(impl Into)`](crate::operation::get_constructor::builders::GetConstructorFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_constructor::builders::GetConstructorFluentBuilder::set_value):
required: **false**
(undocumented)
-+ /// - On success, responds with [`GetConstructorOutput`](crate::operation::get_constructor::GetConstructorOutput) with field(s): -+ /// - [`internal_config_string(Option)`](crate::operation::get_constructor::GetConstructorOutput::internal_config_string): (undocumented) -+ /// - [`blob_value(Option)`](crate::operation::get_constructor::GetConstructorOutput::blob_value): (undocumented) -+ /// - [`boolean_value(Option)`](crate::operation::get_constructor::GetConstructorOutput::boolean_value): (undocumented) -+ /// - [`string_value(Option)`](crate::operation::get_constructor::GetConstructorOutput::string_value): (undocumented) -+ /// - [`integer_value(Option)`](crate::operation::get_constructor::GetConstructorOutput::integer_value): (undocumented) -+ /// - [`long_value(Option)`](crate::operation::get_constructor::GetConstructorOutput::long_value): (undocumented) -+ /// - On failure, responds with [`SdkError`](crate::operation::get_constructor::GetConstructorError) -+ pub fn get_constructor( -+ &self, -+ ) -> crate::operation::get_constructor::builders::GetConstructorFluentBuilder { -+ crate::operation::get_constructor::builders::GetConstructorFluentBuilder::new(self.clone()) -+ } -+} -diff --git b/TestModels/Constructor/runtimes/rust/src/config.rs a/TestModels/Constructor/runtimes/rust/src/config.rs -new file mode 100644 -index 00000000..4e944c46 ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/config.rs -@@ -0,0 +1,119 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Configuration for a simple service client. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Config { -+ pub(crate) blob_value: Option>, -+ pub(crate) boolean_value: Option, -+ pub(crate) string_value: Option, -+ pub(crate) integer_value: Option, -+ pub(crate) long_value: Option, -+} -+ -+impl Config { -+ /// Constructs a config builder. -+ pub fn builder() -> Builder { -+ Builder::default() -+ } -+ /// Converts this config back into a builder so that it can be tweaked. -+ pub fn to_builder(&self) -> Builder { -+ Builder { -+ blob_value: self.blob_value.clone(), -+ boolean_value: self.boolean_value, -+ string_value: self.string_value.clone(), -+ integer_value: self.integer_value, -+ long_value: self.long_value, -+ } -+ } -+} -+/// Builder for creating a `Config`. -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Builder { -+ pub(crate) blob_value: Option>, -+ pub(crate) boolean_value: Option, -+ pub(crate) string_value: Option, -+ pub(crate) integer_value: Option, -+ pub(crate) long_value: Option, -+} -+impl ::std::default::Default for Builder { -+ fn default() -> Self { -+ Self { -+ blob_value: Some(vec![0]), -+ boolean_value: Some(false), -+ string_value: Some("".to_string()), -+ integer_value: Some(0), -+ long_value: Some(0), -+ } -+ } -+} -+impl Builder { -+ /// Constructs a config builder. -+ pub fn new() -> Self { -+ Self::default() -+ } -+ -+ pub fn blob_value(mut self, blob_value: Vec) -> Self { -+ self.set_blob_value(Some(blob_value)); -+ self -+ } -+ -+ pub fn set_blob_value(&mut self, blob_value: Option>) -> &mut Self { -+ self.blob_value = blob_value; -+ self -+ } -+ -+ pub fn boolean_value(mut self, boolean_value: bool) -> Self { -+ self.set_boolean_value(Some(boolean_value)); -+ self -+ } -+ -+ pub fn set_boolean_value(&mut self, boolean_value: Option) -> &mut Self { -+ self.boolean_value = boolean_value; -+ self -+ } -+ -+ pub fn string_value(mut self, string_value: String) -> Self { -+ self.set_string_value(Some(string_value)); -+ self -+ } -+ -+ pub fn set_string_value(&mut self, string_value: Option) -> &mut Self { -+ self.string_value = string_value; -+ self -+ } -+ -+ pub fn integer_value(mut self, integer_value: i32) -> Self { -+ self.set_integer_value(Some(integer_value)); -+ self -+ } -+ -+ pub fn set_integer_value(&mut self, integer_value: Option) -> &mut Self { -+ self.integer_value = integer_value; -+ self -+ } -+ -+ pub fn long_value(mut self, long_value: i64) -> Self { -+ self.set_long_value(Some(long_value)); -+ self -+ } -+ -+ pub fn set_long_value(&mut self, long_value: Option) -> &mut Self { -+ self.long_value = long_value; -+ self -+ } -+ -+ /// Builds a [`Config`]. -+ #[allow(unused_mut)] -+ pub fn build(mut self) -> Config { -+ Config { -+ blob_value: self.blob_value, -+ boolean_value: self.boolean_value, -+ string_value: self.string_value, -+ integer_value: self.integer_value, -+ long_value: self.long_value, -+ } -+ } -+} -+ -+pub use ::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion; -diff --git b/TestModels/Constructor/runtimes/rust/src/conversions.rs a/TestModels/Constructor/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..d6c2383c ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/conversions.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_constructor; -+pub mod simple_constructor_config; -diff --git b/TestModels/Constructor/runtimes/rust/src/conversions/get_constructor.rs a/TestModels/Constructor/runtimes/rust/src/conversions/get_constructor.rs -new file mode 100644 -index 00000000..cb568f9f ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/conversions/get_constructor.rs -@@ -0,0 +1,48 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[allow(dead_code)] -+pub fn to_dafny_error( -+ value: crate::operation::get_constructor::GetConstructorError, -+) -> ::std::rc::Rc< -+ crate::simple::constructor::internaldafny::types::Error, -+> { -+ match value { -+ crate::operation::get_constructor::GetConstructorError::Unhandled(unhandled) => { -+ ::std::rc::Rc::new( -+ crate::simple::constructor::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::simple::constructor::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_constructor::GetConstructorError { -+ // 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::simple::constructor::internaldafny::types::Error::CollectionOfErrors { .. } -+ ) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_constructor::GetConstructorError::generic( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message(error_message) -+ .build(), -+ ) -+ } else { -+ crate::operation::get_constructor::GetConstructorError::generic( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Opaque error") -+ .build(), -+ ) -+ } -+} -+ -+pub mod _get_constructor_input; -+ -+pub mod _get_constructor_output; -diff --git b/TestModels/Constructor/runtimes/rust/src/conversions/get_constructor/_get_constructor_input.rs a/TestModels/Constructor/runtimes/rust/src/conversions/get_constructor/_get_constructor_input.rs -new file mode 100644 -index 00000000..fdb5c4e3 ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/conversions/get_constructor/_get_constructor_input.rs -@@ -0,0 +1,41 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_constructor::GetConstructorInput, -+) -> ::std::rc::Rc< -+ crate::simple::constructor::internaldafny::types::GetConstructorInput, -+>{ -+ 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::simple::constructor::internaldafny::types::GetConstructorInput::GetConstructorInput { -+ value: ::std::rc::Rc::new(dafny_value) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::simple::constructor::internaldafny::types::GetConstructorInput, -+ >, -+) -> crate::operation::get_constructor::GetConstructorInput { -+ 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_constructor::GetConstructorInput { value } -+} -diff --git b/TestModels/Constructor/runtimes/rust/src/conversions/get_constructor/_get_constructor_output.rs a/TestModels/Constructor/runtimes/rust/src/conversions/get_constructor/_get_constructor_output.rs -new file mode 100644 -index 00000000..9374bd3e ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/conversions/get_constructor/_get_constructor_output.rs -@@ -0,0 +1,170 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_constructor::GetConstructorOutput, -+) -> ::std::rc::Rc< -+ crate::simple::constructor::internaldafny::types::GetConstructorOutput, -+>{ -+ let crate::operation::get_constructor::GetConstructorOutput { -+ internal_config_string, -+ blob_value, -+ boolean_value, -+ string_value, -+ integer_value, -+ long_value, -+ } = value; -+ -+ let internal_config_string = match internal_config_string { -+ 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 {}, -+ }; -+ -+ let blob_value = match blob_value { -+ Some(v) => crate::_Wrappers_Compile::Option::Some { -+ value: ::dafny_runtime::Sequence::from_array(&v), -+ }, -+ None => crate::_Wrappers_Compile::Option::None {}, -+ }; -+ -+ let boolean_value = match boolean_value { -+ Some(value) => crate::_Wrappers_Compile::Option::Some { value }, -+ None => crate::_Wrappers_Compile::Option::None {}, -+ }; -+ -+ let string_value = match string_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 {}, -+ }; -+ -+ let integer_value = match integer_value { -+ Some(value) => crate::_Wrappers_Compile::Option::Some { value }, -+ None => crate::_Wrappers_Compile::Option::None {}, -+ }; -+ -+ let long_value = match long_value { -+ Some(value) => crate::_Wrappers_Compile::Option::Some { value }, -+ None => crate::_Wrappers_Compile::Option::None {}, -+ }; -+ -+ ::std::rc::Rc::new(crate::simple::constructor::internaldafny::types::GetConstructorOutput::GetConstructorOutput { -+ internalConfigString: ::std::rc::Rc::new(internal_config_string), -+ blobValue: ::std::rc::Rc::new(blob_value), -+ booleanValue: ::std::rc::Rc::new(boolean_value), -+ stringValue: ::std::rc::Rc::new(string_value), -+ integerValue: ::std::rc::Rc::new(integer_value), -+ longValue: ::std::rc::Rc::new(long_value), -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::simple::constructor::internaldafny::types::GetConstructorOutput, -+ >, -+) -> crate::operation::get_constructor::GetConstructorOutput { -+ let internal_config_string = if matches!( -+ dafny_value.internalConfigString().as_ref(), -+ crate::_Wrappers_Compile::Option::Some { .. } -+ ) { -+ Some( -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( -+ &dafny_value.internalConfigString().Extract(), -+ ), -+ ) -+ } else if matches!( -+ dafny_value.internalConfigString().as_ref(), -+ crate::_Wrappers_Compile::Option::None { .. } -+ ) { -+ None -+ } else { -+ panic!("Unreachable") -+ }; -+ -+ let blob_value = if matches!( -+ dafny_value.blobValue().as_ref(), -+ crate::_Wrappers_Compile::Option::Some { .. } -+ ) { -+ Some( -+ dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec( -+ &dafny_value.blobValue().Extract(), -+ |e| *e, -+ ), -+ ) -+ } else if matches!( -+ dafny_value.blobValue().as_ref(), -+ crate::_Wrappers_Compile::Option::None { .. } -+ ) { -+ None -+ } else { -+ panic!("Unreachable") -+ }; -+ -+ let boolean_value = if matches!( -+ dafny_value.booleanValue().as_ref(), -+ crate::_Wrappers_Compile::Option::Some { .. } -+ ) { -+ Some(dafny_value.booleanValue().Extract()) -+ } else if matches!( -+ dafny_value.booleanValue().as_ref(), -+ crate::_Wrappers_Compile::Option::None { .. } -+ ) { -+ None -+ } else { -+ panic!("Unreachable") -+ }; -+ -+ let string_value = if matches!( -+ dafny_value.stringValue().as_ref(), -+ crate::_Wrappers_Compile::Option::Some { .. } -+ ) { -+ Some( -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( -+ &dafny_value.stringValue().Extract(), -+ ), -+ ) -+ } else if matches!( -+ dafny_value.stringValue().as_ref(), -+ crate::_Wrappers_Compile::Option::None { .. } -+ ) { -+ None -+ } else { -+ panic!("Unreachable") -+ }; -+ -+ let integer_value = if matches!( -+ dafny_value.integerValue().as_ref(), -+ crate::_Wrappers_Compile::Option::Some { .. } -+ ) { -+ Some(dafny_value.integerValue().Extract()) -+ } else if matches!( -+ dafny_value.integerValue().as_ref(), -+ crate::_Wrappers_Compile::Option::None { .. } -+ ) { -+ None -+ } else { -+ panic!("Unreachable") -+ }; -+ -+ let long_value = if matches!( -+ dafny_value.longValue().as_ref(), -+ crate::_Wrappers_Compile::Option::Some { .. } -+ ) { -+ Some(dafny_value.longValue().Extract()) -+ } else if matches!( -+ dafny_value.longValue().as_ref(), -+ crate::_Wrappers_Compile::Option::None { .. } -+ ) { -+ None -+ } else { -+ panic!("Unreachable") -+ }; -+ -+ crate::operation::get_constructor::GetConstructorOutput { -+ internal_config_string, -+ blob_value, -+ boolean_value, -+ string_value, -+ integer_value, -+ long_value, -+ } -+} -diff --git b/TestModels/Constructor/runtimes/rust/src/conversions/simple_constructor_config.rs a/TestModels/Constructor/runtimes/rust/src/conversions/simple_constructor_config.rs -new file mode 100644 -index 00000000..e75ae86f ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/conversions/simple_constructor_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_constructor_config; -diff --git b/TestModels/Constructor/runtimes/rust/src/conversions/simple_constructor_config/_simple_constructor_config.rs a/TestModels/Constructor/runtimes/rust/src/conversions/simple_constructor_config/_simple_constructor_config.rs -new file mode 100644 -index 00000000..61c4d56f ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/conversions/simple_constructor_config/_simple_constructor_config.rs -@@ -0,0 +1,59 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use crate::standard_library_conversions::{ -+ obool_from_dafny, obool_to_dafny, oint_from_dafny, oint_to_dafny, olong_from_dafny, -+ olong_to_dafny, ostring_from_dafny, ostring_to_dafny, -+}; -+ -+#[allow(dead_code)] -+pub fn to_dafny( -+ config: crate::config::Config, -+) -> ::std::rc::Rc< -+ crate::simple::constructor::internaldafny::types::SimpleConstructorConfig, -+>{ -+ ::std::rc::Rc::new( -+ crate::simple::constructor::internaldafny::types::SimpleConstructorConfig::SimpleConstructorConfig { blobValue: blob_to_dafny(config.blob_value), booleanValue: obool_to_dafny(config.boolean_value), stringValue: ostring_to_dafny(&config.string_value), integerValue: oint_to_dafny(config.integer_value), longValue: olong_to_dafny(config.long_value) }) -+} -+ -+fn blob_to_dafny( -+ value: ::std::option::Option<::std::vec::Vec>, -+) -> ::std::rc::Rc< -+ crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence>, -+> { -+ let v = match value { -+ Some(v) => crate::_Wrappers_Compile::Option::Some { -+ value: ::dafny_runtime::Sequence::from_array(&v), -+ }, -+ None => crate::_Wrappers_Compile::Option::None {}, -+ }; -+ -+ ::std::rc::Rc::new(v) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ config: ::std::rc::Rc< -+ crate::simple::constructor::internaldafny::types::SimpleConstructorConfig, -+ >, -+) -> crate::config::Config { -+ crate::config::Config { -+ blob_value: blob_from_dafny(config.blobValue().clone()), -+ boolean_value: obool_from_dafny(config.booleanValue().clone()), -+ string_value: ostring_from_dafny(config.stringValue().clone()), -+ integer_value: oint_from_dafny(config.integerValue().clone()), -+ long_value: olong_from_dafny(config.longValue().clone()), -+ } -+} -+ -+fn blob_from_dafny( -+ value: ::std::rc::Rc< -+ crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence>, -+ >, -+) -> ::std::option::Option<::std::vec::Vec> { -+ match value.as_ref() { -+ crate::_Wrappers_Compile::Option::Some { value } => { -+ Some(::std::rc::Rc::try_unwrap(value.to_array()).unwrap_or_else(|rc| (*rc).clone())) -+ } -+ crate::_Wrappers_Compile::Option::None {} => None, -+ } -+} -diff --git b/TestModels/Constructor/runtimes/rust/src/error.rs a/TestModels/Constructor/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/Constructor/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/Constructor/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/Constructor/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/Constructor/runtimes/rust/src/implementation_from_dafny.rs -index c4ac178d..5aea81e2 100644 ---- b/TestModels/Constructor/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/Constructor/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,26 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+#[doc(inline)] -+pub use config::Config; -+ -+pub mod client; -+ -+/// Configuration for Constructor Service. -+pub mod config; -+ -+/// Common errors and error handling utilities. -+pub mod error; -+ -+/// All operations that this crate can perform. -+pub mod operation; -+ -+pub mod conversions; -+mod standard_library_conversions; -+ -+pub use client::Client; -+ -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -diff --git b/TestModels/Constructor/runtimes/rust/src/lib.rs a/TestModels/Constructor/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..9986830f ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/lib.rs -@@ -0,0 +1,23 @@ -+#![allow(deprecated)] -+ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[doc(inline)] -+pub use config::Config; -+ -+pub mod client; -+ -+/// Configuration for Constructor Service. -+pub mod config; -+ -+/// 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; -+ -+mod implementation_from_dafny; -diff --git b/TestModels/Constructor/runtimes/rust/src/operation.rs a/TestModels/Constructor/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..8de453d5 ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/operation.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetConstructor` operation. -+pub mod get_constructor; -diff --git b/TestModels/Constructor/runtimes/rust/src/operation/get_constructor.rs a/TestModels/Constructor/runtimes/rust/src/operation/get_constructor.rs -new file mode 100644 -index 00000000..3551482e ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/operation/get_constructor.rs -@@ -0,0 +1,146 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetConstructor`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetConstructor; -+impl GetConstructor { -+ /// Creates a new `GetConstructor` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_constructor::GetConstructorInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_constructor::GetConstructorOutput, -+ crate::operation::get_constructor::GetConstructorError, -+ > { -+ let inner_input = -+ crate::conversions::get_constructor::_get_constructor_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetConstructor(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_constructor::_get_constructor_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_constructor::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetConstructor` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetConstructorError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetConstructorError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetConstructorError { -+ /// Creates the `GetConstructorError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetConstructorError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetConstructorError { -+ 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 GetConstructorError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetConstructorError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetConstructorError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetConstructorError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_constructor::_get_constructor_output::GetConstructorOutput; -+ -+pub use crate::operation::get_constructor::_get_constructor_input::GetConstructorInput; -+ -+mod _get_constructor_input; -+ -+mod _get_constructor_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/_get_constructor_input.rs a/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/_get_constructor_input.rs -new file mode 100644 -index 00000000..227b5efb ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/_get_constructor_input.rs -@@ -0,0 +1,56 @@ -+// 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 GetConstructorInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option<::std::string::String>, -+} -+impl GetConstructorInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option<&str> { -+ self.value.as_deref() -+ } -+} -+impl GetConstructorInput { -+ /// Creates a new builder-style object to manufacture [`GetConstructorInput`](crate::operation::get_constructor::GetConstructorInput). -+ pub fn builder() -> crate::operation::get_constructor::builders::GetConstructorInputBuilder { -+ crate::operation::get_constructor::builders::GetConstructorInputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetConstructorInput`](crate::operation::get_constructor::GetConstructorInput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetConstructorInputBuilder { -+ pub(crate) value: ::std::option::Option<::std::string::String>, -+} -+impl GetConstructorInputBuilder { -+ #[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 [`GetConstructorInput`](crate::operation::get_constructor::GetConstructorInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_constructor::GetConstructorInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_constructor::GetConstructorInput { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/_get_constructor_output.rs a/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/_get_constructor_output.rs -new file mode 100644 -index 00000000..cb866fb8 ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/_get_constructor_output.rs -@@ -0,0 +1,171 @@ -+// 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 GetConstructorOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub internal_config_string: ::std::option::Option<::std::string::String>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub blob_value: ::std::option::Option<::std::vec::Vec>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub boolean_value: ::std::option::Option, -+ #[allow(missing_docs)] // documentation missing in model -+ pub string_value: ::std::option::Option<::std::string::String>, -+ #[allow(missing_docs)] // documentation missing in model -+ pub integer_value: ::std::option::Option, -+ #[allow(missing_docs)] // documentation missing in model -+ pub long_value: ::std::option::Option, -+} -+ -+impl GetConstructorOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn internal_config_string(&self) -> ::std::option::Option<&str> { -+ self.internal_config_string.as_deref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn blob_value(&self) -> ::std::option::Option<&[u8]> { -+ self.blob_value.as_deref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn boolean_value(&self) -> ::std::option::Option { -+ self.boolean_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn string_value(&self) -> ::std::option::Option<&str> { -+ self.string_value.as_deref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn integer_value(&self) -> ::std::option::Option { -+ self.integer_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn long_value(&self) -> ::std::option::Option { -+ self.long_value -+ } -+} -+ -+impl GetConstructorOutput { -+ /// Creates a new builder-style object to manufacture [`GetConstructorOutput`](crate::operation::get_constructor::GetConstructorOutput). -+ pub fn builder() -> crate::operation::get_constructor::builders::GetConstructorOutputBuilder { -+ crate::operation::get_constructor::builders::GetConstructorOutputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetConstructorOutput`](crate::operation::get_constructor::GetConstructorOutput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetConstructorOutputBuilder { -+ pub(crate) internal_config_string: ::std::option::Option<::std::string::String>, -+ pub(crate) blob_value: ::std::option::Option<::std::vec::Vec>, -+ pub(crate) boolean_value: ::std::option::Option, -+ pub(crate) string_value: ::std::option::Option<::std::string::String>, -+ pub(crate) integer_value: ::std::option::Option, -+ pub(crate) long_value: ::std::option::Option, -+} -+ -+impl GetConstructorOutputBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn internal_config_string( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.internal_config_string = ::std::option::Option::Some(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_internal_config_string( -+ mut self, -+ input: ::std::option::Option<::std::string::String>, -+ ) -> Self { -+ self.internal_config_string = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_internal_config_string(&self) -> &::std::option::Option<::std::string::String> { -+ &self.internal_config_string -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn blob_value(mut self, input: ::std::vec::Vec) -> Self { -+ self.blob_value = ::std::option::Option::Some(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_blob_value(mut self, input: ::std::option::Option<::std::vec::Vec>) -> Self { -+ self.blob_value = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_blob_value(&self) -> &::std::option::Option<::std::vec::Vec> { -+ &self.blob_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn boolean_value(mut self, input: bool) -> Self { -+ self.boolean_value = ::std::option::Option::Some(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_boolean_value(mut self, input: ::std::option::Option) -> Self { -+ self.boolean_value = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_boolean_value(&self) -> &::std::option::Option { -+ &self.boolean_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn string_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { -+ self.string_value = ::std::option::Option::Some(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_string_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { -+ self.string_value = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_string_value(&self) -> &::std::option::Option<::std::string::String> { -+ &self.string_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn integer_value(mut self, input: i32) -> Self { -+ self.integer_value = ::std::option::Option::Some(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_integer_value(mut self, input: ::std::option::Option) -> Self { -+ self.integer_value = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_integer_value(&self) -> &::std::option::Option { -+ &self.integer_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn long_value(mut self, input: i64) -> Self { -+ self.long_value = ::std::option::Option::Some(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_long_value(mut self, input: ::std::option::Option) -> Self { -+ self.long_value = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_long_value(&self) -> &::std::option::Option { -+ &self.long_value -+ } -+ -+ /// Consumes the builder and constructs a [`GetConstructorOutput`](crate::operation::get_constructor::GetConstructorOutput). -+ pub fn build(self) -> crate::operation::get_constructor::GetConstructorOutput { -+ crate::operation::get_constructor::GetConstructorOutput { -+ internal_config_string: self.internal_config_string, -+ blob_value: self.blob_value, -+ boolean_value: self.boolean_value, -+ string_value: self.string_value, -+ integer_value: self.integer_value, -+ long_value: self.long_value, -+ } -+ } -+} -diff --git b/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/builders.rs a/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/builders.rs -new file mode 100644 -index 00000000..52045c7e ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/builders.rs -@@ -0,0 +1,91 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_constructor::_get_constructor_output::GetConstructorOutputBuilder; -+ -+pub use crate::operation::get_constructor::_get_constructor_input::GetConstructorInputBuilder; -+ -+impl GetConstructorInputBuilder { -+ /// 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_constructor::GetConstructorOutput, -+ crate::operation::get_constructor::GetConstructorError, -+ > { -+ let mut fluent_builder = client.get_constructor(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetConstructor`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetConstructorFluentBuilder { -+ client: crate::Client, -+ inner: crate::operation::get_constructor::builders::GetConstructorInputBuilder, -+ config_override: ::std::option::Option, -+} -+impl GetConstructorFluentBuilder { -+ /// Creates a new `GetConstructorFluentBuilder`. -+ pub(crate) fn new(client: crate::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ config_override: ::std::option::Option::None, -+ } -+ } -+ /// Access the GetConstructor as a reference. -+ pub fn as_input( -+ &self, -+ ) -> &crate::operation::get_constructor::builders::GetConstructorInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_constructor::GetConstructorOutput, -+ crate::operation::get_constructor::GetConstructorError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetConstructor 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_constructor::GetConstructorError::unhandled)?; -+ crate::operation::get_constructor::GetConstructor::send(&self.client, input).await -+ } -+ -+ pub(crate) fn config_override( -+ mut self, -+ config_override: impl ::std::convert::Into, -+ ) -> Self { -+ self.set_config_override(::std::option::Option::Some(config_override.into())); -+ self -+ } -+ -+ pub(crate) fn set_config_override( -+ &mut self, -+ config_override: ::std::option::Option, -+ ) -> &mut Self { -+ self.config_override = config_override; -+ self -+ } -+ #[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() -+ } -+} -diff --git b/TestModels/Constructor/runtimes/rust/src/standard_library_conversions.rs a/TestModels/Constructor/runtimes/rust/src/standard_library_conversions.rs -new file mode 100644 -index 00000000..2fec0ffb ---- /dev/null -+++ a/TestModels/Constructor/runtimes/rust/src/standard_library_conversions.rs -@@ -0,0 +1,246 @@ -+pub fn ostring_to_dafny( -+ input: &Option, -+) -> ::std::rc::Rc< -+ 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 {}, -+}; -+ ::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>>, -+ >, -+) -> 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 -+ } -+} -+ -+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 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) -+} -+ -+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 -+ } -+} -+ -+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 blob_to_dafny( -+ input: &::aws_smithy_types::Blob, -+) -> ::dafny_runtime::Sequence { -+ ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) -+} -+ -+pub fn oblob_to_dafny( -+ 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) -+} -+ -+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>>, -+) -> Option<::aws_smithy_types::Blob> { -+ 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 odouble_to_dafny( -+ 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) -+} -+ -+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>>, -+) -> Option { -+ 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, -+) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { -+ ::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) -+} -+ -+pub fn timestamp_from_dafny( -+ 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() -+} -+ -+pub fn otimestamp_from_dafny( -+ input: ::std::rc::Rc>>, -+) -> Option<::aws_smithy_types::DateTime> { -+ 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, -+) -> Option { -+ 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, -+) -> ::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 {} -+ ), -+ } -+} -+ -+pub fn result_from_dafny( -+ 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)), -+ } -+} -+ -+pub fn result_to_dafny( -+ 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 diff --git a/TestModels/Constructor/runtimes/rust/src/client.rs b/TestModels/Constructor/runtimes/rust/src/client.rs index e209cceda..78fdec1a9 100644 --- a/TestModels/Constructor/runtimes/rust/src/client.rs +++ b/TestModels/Constructor/runtimes/rust/src/client.rs @@ -10,7 +10,7 @@ pub struct Client { impl Client { /// Creates a new client from the service [`Config`](crate::Config). #[track_caller] - pub fn from_conf(conf: crate::Config) -> Result { + pub fn from_conf(conf: crate::types::simple_constructor_config::SimpleConstructorConfig) -> Result { let inner = crate::r#simple::constructor::internaldafny::_default::SimpleConstructor( &crate::conversions::simple_constructor_config::_simple_constructor_config::to_dafny(conf), diff --git a/TestModels/Constructor/runtimes/rust/src/conversions/simple_constructor_config/_simple_constructor_config.rs b/TestModels/Constructor/runtimes/rust/src/conversions/simple_constructor_config/_simple_constructor_config.rs index 61c4d56fa..65f150dea 100644 --- a/TestModels/Constructor/runtimes/rust/src/conversions/simple_constructor_config/_simple_constructor_config.rs +++ b/TestModels/Constructor/runtimes/rust/src/conversions/simple_constructor_config/_simple_constructor_config.rs @@ -7,7 +7,7 @@ use crate::standard_library_conversions::{ #[allow(dead_code)] pub fn to_dafny( - config: crate::config::Config, + config: crate::types::simple_constructor_config::SimpleConstructorConfig, ) -> ::std::rc::Rc< crate::simple::constructor::internaldafny::types::SimpleConstructorConfig, >{ @@ -35,8 +35,8 @@ pub fn from_dafny( config: ::std::rc::Rc< crate::simple::constructor::internaldafny::types::SimpleConstructorConfig, >, -) -> crate::config::Config { - crate::config::Config { +) -> crate::types::simple_constructor_config::SimpleConstructorConfig { + crate::types::simple_constructor_config::SimpleConstructorConfig { blob_value: blob_from_dafny(config.blobValue().clone()), boolean_value: obool_from_dafny(config.booleanValue().clone()), string_value: ostring_from_dafny(config.stringValue().clone()), diff --git a/TestModels/Constructor/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/Constructor/runtimes/rust/src/implementation_from_dafny.rs index 5aea81e23..49faf9293 100644 --- a/TestModels/Constructor/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/Constructor/runtimes/rust/src/implementation_from_dafny.rs @@ -1,13 +1,8 @@ #![allow(warnings, unconditional_panic)] #![allow(nonstandard_style)] -#[doc(inline)] -pub use config::Config; - pub mod client; - -/// Configuration for Constructor Service. -pub mod config; +pub mod types; /// Common errors and error handling utilities. pub mod error; @@ -15,11 +10,14 @@ pub mod error; /// All operations that this crate can perform. pub mod operation; -pub mod conversions; +mod conversions; mod standard_library_conversions; -pub use client::Client; +#[cfg(feature = "wrapped-client")] +pub mod wrapped; +pub use client::Client; +pub use types::simple_constructor_config::SimpleConstructorConfig; pub mod r#_Wrappers_Compile { pub use dafny_runtime::DafnyPrint; diff --git a/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/builders.rs b/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/builders.rs index 52045c7e1..b2f6bdedd 100644 --- a/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/builders.rs +++ b/TestModels/Constructor/runtimes/rust/src/operation/get_constructor/builders.rs @@ -23,7 +23,7 @@ impl GetConstructorInputBuilder { pub struct GetConstructorFluentBuilder { client: crate::Client, inner: crate::operation::get_constructor::builders::GetConstructorInputBuilder, - config_override: ::std::option::Option, + config_override: ::std::option::Option, } impl GetConstructorFluentBuilder { /// Creates a new `GetConstructorFluentBuilder`. @@ -61,7 +61,7 @@ impl GetConstructorFluentBuilder { pub(crate) fn config_override( mut self, - config_override: impl ::std::convert::Into, + config_override: impl ::std::convert::Into, ) -> Self { self.set_config_override(::std::option::Option::Some(config_override.into())); self @@ -69,7 +69,7 @@ impl GetConstructorFluentBuilder { pub(crate) fn set_config_override( &mut self, - config_override: ::std::option::Option, + config_override: ::std::option::Option, ) -> &mut Self { self.config_override = config_override; self diff --git a/TestModels/Constructor/runtimes/rust/src/types.rs b/TestModels/Constructor/runtimes/rust/src/types.rs new file mode 100644 index 000000000..476cdee2b --- /dev/null +++ b/TestModels/Constructor/runtimes/rust/src/types.rs @@ -0,0 +1,4 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + +/// Types for the `SimpleConstructorConfig` +pub mod simple_constructor_config; diff --git a/TestModels/Constructor/runtimes/rust/src/config.rs b/TestModels/Constructor/runtimes/rust/src/types/simple_constructor_config.rs similarity index 95% rename from TestModels/Constructor/runtimes/rust/src/config.rs rename to TestModels/Constructor/runtimes/rust/src/types/simple_constructor_config.rs index 4e944c467..e71679d2c 100644 --- a/TestModels/Constructor/runtimes/rust/src/config.rs +++ b/TestModels/Constructor/runtimes/rust/src/types/simple_constructor_config.rs @@ -3,7 +3,7 @@ /// Configuration for a simple service client. /// #[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct Config { +pub struct SimpleConstructorConfig { pub(crate) blob_value: Option>, pub(crate) boolean_value: Option, pub(crate) string_value: Option, @@ -11,7 +11,7 @@ pub struct Config { pub(crate) long_value: Option, } -impl Config { +impl SimpleConstructorConfig { /// Constructs a config builder. pub fn builder() -> Builder { Builder::default() @@ -105,8 +105,8 @@ impl Builder { /// Builds a [`Config`]. #[allow(unused_mut)] - pub fn build(mut self) -> Config { - Config { + pub fn build(mut self) -> SimpleConstructorConfig { + SimpleConstructorConfig { blob_value: self.blob_value, boolean_value: self.boolean_value, string_value: self.string_value, diff --git a/TestModels/Constructor/runtimes/rust/tests/constructor_test.rs b/TestModels/Constructor/runtimes/rust/tests/constructor_test.rs index 8b56425ed..985177a2b 100644 --- a/TestModels/Constructor/runtimes/rust/tests/constructor_test.rs +++ b/TestModels/Constructor/runtimes/rust/tests/constructor_test.rs @@ -57,7 +57,7 @@ use constructor::{ } */ #[tokio::test] async fn test_get_constructor_with_default_config() { - let config = Config::builder().build(); + let config = SimpleConstructorConfig::builder().build(); let client = Client::from_conf(config).unwrap(); let expected_output = GetConstructorOutput::builder() @@ -74,7 +74,7 @@ async fn test_get_constructor_with_default_config() { #[tokio::test] async fn test_get_constructor_with_param_config() { - let config = Config::builder() + let config = SimpleConstructorConfig::builder() .blob_value(vec![0, 0, 7]) .boolean_value(true) .string_value("ParamString".to_string()) diff --git a/TestModels/Refinement/Makefile b/TestModels/Refinement/Makefile index 4b0cf60dc..0009f4e89 100644 --- a/TestModels/Refinement/Makefile +++ b/TestModels/Refinement/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../SharedMakefile.mk NAMESPACE=simple.refinement diff --git a/TestModels/Refinement/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/Refinement/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index 2c973a895..000000000 --- a/TestModels/Refinement/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,2608 +0,0 @@ -diff --git b/TestModels/Refinement/runtimes/rust/src/client.rs a/TestModels/Refinement/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..b9d63c1f ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/client.rs -@@ -0,0 +1,40 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ pub fn from_conf( -+ conf: crate::types::simple_refinement_config::SimpleRefinementConfig, -+ ) -> Result { -+ let inner = -+ crate::simple::refinement::internaldafny::_default::SimpleRefinement( -+ &crate::conversions::simple_refinement_config::_simple_refinement_config::to_dafny(conf), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+mod get_refinement; -+mod only_input; -+mod only_output; -+mod readonly_operation; -diff --git b/TestModels/Refinement/runtimes/rust/src/client/get_refinement.rs a/TestModels/Refinement/runtimes/rust/src/client/get_refinement.rs -new file mode 100644 -index 00000000..0d1deb84 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/client/get_refinement.rs -@@ -0,0 +1,17 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetRefinement`](crate::operation::get_refinement::builders::GetRefinementFluentBuilder) operation. -+ /// -+ /// - The fluent builder is configurable: -+ /// - [`required_string(impl Into)`](crate::operation::get_refinement::builders::GetRefinementFluentBuilder::required_string) / [`set_required_string(Option)`](crate::operation::get_refinement::builders::GetRefinementFluentBuilder::set_required_string):
required: **true**
(undocumented)
-+ /// - [`optional_string(impl Into)`](crate::operation::get_refinement::builders::GetRefinementFluentBuilder::optional_string) / [`set_optional_string(Option)`](crate::operation::get_refinement::builders::GetRefinementFluentBuilder::set_optional_string):
required: **false**
(undocumented)
-+ /// - On success, responds with [`GetRefinementOutput`](crate::operation::get_refinement::GetRefinementOutput) with field(s): -+ /// - [`required_string(String)`](crate::operation::get_refinement::GetRefinementOutput::required_string): (undocumented) -+ /// - [`optional_string(Option)`](crate::operation::get_refinement::GetRefinementOutput::optional_string): (undocumented) -+ /// - On failure, responds with [`SdkError`](crate::operation::get_refinement::GetRefinementError) -+ pub fn get_refinement( -+ &self, -+ ) -> crate::operation::get_refinement::builders::GetRefinementFluentBuilder { -+ crate::operation::get_refinement::builders::GetRefinementFluentBuilder::new(self.clone()) -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/client/only_input.rs a/TestModels/Refinement/runtimes/rust/src/client/only_input.rs -new file mode 100644 -index 00000000..dfab84e9 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/client/only_input.rs -@@ -0,0 +1,12 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`OnlyInput`](crate::operation::only_input::builders::OnlyInputFluentBuilder) operation. -+ /// -+ /// - The fluent builder is configurable: -+ /// - [`value(impl Into)`](crate::operation::only_input::builders::OnlyInputFluentBuilder::value) / [`set_value(Option)`](crate::operation::only_input::builders::OnlyInputFluentBuilder::set_value):
required: **false**
(undocumented)
-+ /// - On success, responds with [`OnlyInputOutput`](crate::operation::only_input::OnlyInputOutput) -+ /// - On failure, responds with [`SdkError`](crate::operation::only_input::OnlyInputError) -+ pub fn only_input(&self) -> crate::operation::only_input::builders::OnlyInputFluentBuilder { -+ crate::operation::only_input::builders::OnlyInputFluentBuilder::new(self.clone()) -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/client/only_output.rs a/TestModels/Refinement/runtimes/rust/src/client/only_output.rs -new file mode 100644 -index 00000000..c0208401 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/client/only_output.rs -@@ -0,0 +1,12 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`OnlyOutput`](crate::operation::only_output::builders::OnlyOutputFluentBuilder) operation. -+ /// -+ /// - The fluent builder takes no input, just [`send`](crate::operation::only_output::builders::OnlyOutputFluentBuilder::send) it. -+ /// - On success, responds with [`OnlyOutputOutput`](crate::operation::only_output::OnlyOutputOutput) with field(s): -+ /// - [`value(Option)`](crate::operation::only_output::OnlyOutputOutput::value): (undocumented) -+ /// - On failure, responds with [`SdkError`](crate::operation::only_output::OnlyOutputError) -+ pub fn only_output(&self) -> crate::operation::only_output::builders::OnlyOutputFluentBuilder { -+ crate::operation::only_output::builders::OnlyOutputFluentBuilder::new(self.clone()) -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/client/readonly_operation.rs a/TestModels/Refinement/runtimes/rust/src/client/readonly_operation.rs -new file mode 100644 -index 00000000..e5e9251f ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/client/readonly_operation.rs -@@ -0,0 +1,19 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`ReadonlyOperation`](crate::operation::readonly_operation::builders::ReadonlyOperationFluentBuilder) operation. -+ /// -+ /// - The fluent builder is configurable: -+ /// - [`required_string(impl Into)`](crate::operation::readonly_operation::builders::ReadonlyOperationFluentBuilder::required_string) / [`set_required_string(Option)`](crate::operation::readonly_operation::builders::ReadonlyOperationFluentBuilder::set_required_string):
required: **true**
(undocumented)
-+ /// - [`optional_string(impl Into)`](crate::operation::readonly_operation::builders::ReadonlyOperationFluentBuilder::optional_string) / [`set_optional_string(Option)`](crate::operation::readonly_operation::builders::ReadonlyOperationFluentBuilder::set_optional_string):
required: **false**
(undocumented)
-+ /// - On success, responds with [`ReadonlyOperationOutput`](crate::operation::readonly_operation::ReadonlyOperationOutput) with field(s): -+ /// - [`required_string(String)`](crate::operation::readonly_operation::ReadonlyOperationOutput::required_string): (undocumented) -+ /// - [`optional_string(Option)`](crate::operation::readonly_operation::ReadonlyOperationOutput::optional_string): (undocumented) -+ /// - On failure, responds with [`SdkError`](crate::operation::readonly_operation::ReadonlyOperationError) -+ pub fn readonly_operation( -+ &self, -+ ) -> crate::operation::readonly_operation::builders::ReadonlyOperationFluentBuilder { -+ crate::operation::readonly_operation::builders::ReadonlyOperationFluentBuilder::new( -+ self.clone(), -+ ) -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions.rs a/TestModels/Refinement/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..54b3f0f2 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions.rs -@@ -0,0 +1,7 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_refinement; -+pub mod only_input; -+pub mod only_output; -+pub mod readonly_operation; -+ -+pub mod simple_refinement_config; -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/get_refinement.rs a/TestModels/Refinement/runtimes/rust/src/conversions/get_refinement.rs -new file mode 100644 -index 00000000..6586e95d ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/get_refinement.rs -@@ -0,0 +1,32 @@ -+// 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_refinement::GetRefinementError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_refinement::GetRefinementError::Unhandled(unhandled) => -+ ::std::rc::Rc::new(crate::r#simple::refinement::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::refinement::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_refinement::GetRefinementError { -+ // 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::refinement::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_refinement::GetRefinementError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_refinement::GetRefinementError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_refinement_input; -+ -+pub mod _get_refinement_output; -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/get_refinement/_get_refinement_input.rs a/TestModels/Refinement/runtimes/rust/src/conversions/get_refinement/_get_refinement_input.rs -new file mode 100644 -index 00000000..1d5b2459 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/get_refinement/_get_refinement_input.rs -@@ -0,0 +1,51 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_refinement::GetRefinementInput, -+) -> ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::GetRefinementInput, -+> { -+ let crate::operation::get_refinement::GetRefinementInput { -+ required_string, -+ optional_string, -+ } = value; -+ -+ let required_string = -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( -+ &required_string, -+ ); -+ -+ let optional_string = match optional_string { -+ 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::refinement::internaldafny::types::GetRefinementInput::GetRefinementInput { -+ requiredString: required_string, -+ optionalString: ::std::rc::Rc::new(optional_string), -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::GetRefinementInput, -+ >, -+) -> crate::operation::get_refinement::GetRefinementInput { -+ let crate::r#simple::refinement::internaldafny::types::GetRefinementInput::GetRefinementInput { requiredString, optionalString } = dafny_value.as_ref(); -+ -+ let required_string = -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( -+ requiredString, -+ ); -+ -+ let optional_string = match optionalString.as_ref() { -+ crate::_Wrappers_Compile::Option::None {} => ::std::option::Option::None, -+ crate::_Wrappers_Compile::Option::Some { value } => ::std::option::Option::Some(dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(value)), -+ }; -+ -+ crate::operation::get_refinement::GetRefinementInput { -+ required_string, -+ optional_string, -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/get_refinement/_get_refinement_output.rs a/TestModels/Refinement/runtimes/rust/src/conversions/get_refinement/_get_refinement_output.rs -new file mode 100644 -index 00000000..6ffa4044 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/get_refinement/_get_refinement_output.rs -@@ -0,0 +1,51 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_refinement::GetRefinementOutput, -+) -> ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::GetRefinementOutput, -+> { -+ let crate::operation::get_refinement::GetRefinementOutput { -+ required_string, -+ optional_string, -+ } = value; -+ -+ let required_string = -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( -+ &required_string, -+ ); -+ -+ let optional_string = match optional_string { -+ 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::refinement::internaldafny::types::GetRefinementOutput::GetRefinementOutput { -+ requiredString: required_string, -+ optionalString: ::std::rc::Rc::new(optional_string), -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::GetRefinementOutput, -+ >, -+) -> crate::operation::get_refinement::GetRefinementOutput { -+ let crate::r#simple::refinement::internaldafny::types::GetRefinementOutput::GetRefinementOutput { requiredString, optionalString } = dafny_value.as_ref(); -+ -+ let required_string = -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( -+ &requiredString, -+ ); -+ -+ let optional_string = match optionalString.as_ref() { -+ crate::_Wrappers_Compile::Option::None {} => ::std::option::Option::None, -+ crate::_Wrappers_Compile::Option::Some { value } => ::std::option::Option::Some(dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&value)), -+ }; -+ -+ crate::operation::get_refinement::GetRefinementOutput { -+ required_string, -+ optional_string, -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/only_input.rs a/TestModels/Refinement/runtimes/rust/src/conversions/only_input.rs -new file mode 100644 -index 00000000..460f0edf ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/only_input.rs -@@ -0,0 +1,37 @@ -+// 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::only_input::OnlyInputError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::only_input::OnlyInputError::Unhandled(unhandled) => ::std::rc::Rc::new( -+ crate::r#simple::refinement::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::refinement::internaldafny::types::Error, -+ >, -+) -> crate::operation::only_input::OnlyInputError { -+ // 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::refinement::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::only_input::OnlyInputError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::only_input::OnlyInputError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _only_input_input; -+ -+pub mod _only_input_output; -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/only_input/_only_input_input.rs a/TestModels/Refinement/runtimes/rust/src/conversions/only_input/_only_input_input.rs -new file mode 100644 -index 00000000..fbd63d3f ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/only_input/_only_input_input.rs -@@ -0,0 +1,36 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::only_input::OnlyInputInput, -+) -> ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::OnlyInputInput, -+> { -+ let crate::operation::only_input::OnlyInputInput { value } = value; -+ -+ let optional_string = match 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::refinement::internaldafny::types::OnlyInputInput::OnlyInputInput { -+ value: ::std::rc::Rc::new(optional_string) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::OnlyInputInput, -+ >, -+) -> crate::operation::only_input::OnlyInputInput { -+ let crate::r#simple::refinement::internaldafny::types::OnlyInputInput::OnlyInputInput { value } = dafny_value.as_ref(); -+ -+ let optional_string = match value.as_ref() { -+ crate::_Wrappers_Compile::Option::None {} => ::std::option::Option::None, -+ crate::_Wrappers_Compile::Option::Some { value } => ::std::option::Option::Some(dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&value)), -+ }; -+ -+ crate::operation::only_input::OnlyInputInput { -+ value: optional_string -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/only_input/_only_input_output.rs a/TestModels/Refinement/runtimes/rust/src/conversions/only_input/_only_input_output.rs -new file mode 100644 -index 00000000..24a58661 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/only_input/_only_input_output.rs -@@ -0,0 +1,8 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny(_value: crate::operation::only_input::OnlyInputOutput) {} -+ -+#[allow(dead_code)] -+pub fn from_dafny(_dafny_value: ()) -> crate::operation::only_input::OnlyInputOutput { -+ crate::operation::only_input::OnlyInputOutput {} -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/only_output.rs a/TestModels/Refinement/runtimes/rust/src/conversions/only_output.rs -new file mode 100644 -index 00000000..c9a8d250 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/only_output.rs -@@ -0,0 +1,37 @@ -+// 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::only_output::OnlyOutputError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::only_output::OnlyOutputError::Unhandled(unhandled) => ::std::rc::Rc::new( -+ crate::r#simple::refinement::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::refinement::internaldafny::types::Error, -+ >, -+) -> crate::operation::only_output::OnlyOutputError { -+ // 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::refinement::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::only_output::OnlyOutputError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::only_output::OnlyOutputError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _only_output_input; -+ -+pub mod _only_output_output; -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/only_output/_only_output_input.rs a/TestModels/Refinement/runtimes/rust/src/conversions/only_output/_only_output_input.rs -new file mode 100644 -index 00000000..58e99a74 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/only_output/_only_output_input.rs -@@ -0,0 +1,8 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny(_value: crate::operation::only_output::OnlyOutputInput) {} -+ -+#[allow(dead_code)] -+pub fn from_dafny(_dafny_value: ()) -> crate::operation::only_output::OnlyOutputInput { -+ crate::operation::only_output::OnlyOutputInput {} -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/only_output/_only_output_output.rs a/TestModels/Refinement/runtimes/rust/src/conversions/only_output/_only_output_output.rs -new file mode 100644 -index 00000000..106f9d8c ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/only_output/_only_output_output.rs -@@ -0,0 +1,36 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::only_output::OnlyOutputOutput, -+) -> ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::OnlyOutputOutput, -+> { -+ let crate::operation::only_output::OnlyOutputOutput { value } = value; -+ -+ let optional_string = match 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::refinement::internaldafny::types::OnlyOutputOutput::OnlyOutputOutput { -+ value: ::std::rc::Rc::new(optional_string) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::OnlyOutputOutput, -+ >, -+) -> crate::operation::only_output::OnlyOutputOutput { -+ let crate::r#simple::refinement::internaldafny::types::OnlyOutputOutput::OnlyOutputOutput { value } = dafny_value.as_ref(); -+ -+ let optional_string = match value.as_ref() { -+ crate::_Wrappers_Compile::Option::None {} => ::std::option::Option::None, -+ crate::_Wrappers_Compile::Option::Some { value } => ::std::option::Option::Some(dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&value)), -+ }; -+ -+ crate::operation::only_output::OnlyOutputOutput { -+ value: optional_string, -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/readonly_operation.rs a/TestModels/Refinement/runtimes/rust/src/conversions/readonly_operation.rs -new file mode 100644 -index 00000000..cd6ab475 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/readonly_operation.rs -@@ -0,0 +1,32 @@ -+// 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::readonly_operation::ReadonlyOperationError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::readonly_operation::ReadonlyOperationError::Unhandled(unhandled) => -+ ::std::rc::Rc::new(crate::r#simple::refinement::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::refinement::internaldafny::types::Error, -+ >, -+) -> crate::operation::readonly_operation::ReadonlyOperationError { -+ // 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::refinement::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::readonly_operation::ReadonlyOperationError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::readonly_operation::ReadonlyOperationError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _readonly_operation_input; -+ -+pub mod _readonly_operation_output; -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/readonly_operation/_readonly_operation_input.rs a/TestModels/Refinement/runtimes/rust/src/conversions/readonly_operation/_readonly_operation_input.rs -new file mode 100644 -index 00000000..c6398a37 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/readonly_operation/_readonly_operation_input.rs -@@ -0,0 +1,51 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::readonly_operation::ReadonlyOperationInput, -+) -> ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::ReadonlyOperationInput, -+> { -+ let crate::operation::readonly_operation::ReadonlyOperationInput { -+ required_string, -+ optional_string, -+ } = value; -+ -+ let required_string = -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( -+ &required_string, -+ ); -+ -+ let optional_string = match optional_string { -+ 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::refinement::internaldafny::types::ReadonlyOperationInput::ReadonlyOperationInput { -+ requiredString: required_string, -+ optionalString: ::std::rc::Rc::new(optional_string), -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::ReadonlyOperationInput, -+ >, -+) -> crate::operation::readonly_operation::ReadonlyOperationInput { -+ let crate::r#simple::refinement::internaldafny::types::ReadonlyOperationInput::ReadonlyOperationInput { requiredString, optionalString } = dafny_value.as_ref(); -+ -+ let required_string = -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( -+ &requiredString, -+ ); -+ -+ let optional_string = match optionalString.as_ref() { -+ crate::_Wrappers_Compile::Option::None {} => ::std::option::Option::None, -+ crate::_Wrappers_Compile::Option::Some { value } => ::std::option::Option::Some(dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&value)), -+ }; -+ -+ crate::operation::readonly_operation::ReadonlyOperationInput { -+ required_string, -+ optional_string, -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/readonly_operation/_readonly_operation_output.rs a/TestModels/Refinement/runtimes/rust/src/conversions/readonly_operation/_readonly_operation_output.rs -new file mode 100644 -index 00000000..a00fe9a0 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/readonly_operation/_readonly_operation_output.rs -@@ -0,0 +1,51 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::readonly_operation::ReadonlyOperationOutput, -+) -> ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::ReadonlyOperationOutput, -+> { -+ let crate::operation::readonly_operation::ReadonlyOperationOutput { -+ required_string, -+ optional_string, -+ } = value; -+ -+ let required_string = -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( -+ &required_string, -+ ); -+ -+ let optional_string = match optional_string { -+ 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::refinement::internaldafny::types::ReadonlyOperationOutput::ReadonlyOperationOutput { -+ requiredString: required_string, -+ optionalString: ::std::rc::Rc::new(optional_string), -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::ReadonlyOperationOutput, -+ >, -+) -> crate::operation::readonly_operation::ReadonlyOperationOutput { -+ let crate::r#simple::refinement::internaldafny::types::ReadonlyOperationOutput::ReadonlyOperationOutput { requiredString, optionalString } = dafny_value.as_ref(); -+ -+ let required_string = -+ dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( -+ &requiredString, -+ ); -+ -+ let optional_string = match optionalString.as_ref() { -+ crate::_Wrappers_Compile::Option::None {} => ::std::option::Option::None, -+ crate::_Wrappers_Compile::Option::Some { value } => ::std::option::Option::Some(dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&value)), -+ }; -+ -+ crate::operation::readonly_operation::ReadonlyOperationOutput { -+ required_string, -+ optional_string, -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/simple_refinement_config.rs a/TestModels/Refinement/runtimes/rust/src/conversions/simple_refinement_config.rs -new file mode 100644 -index 00000000..9d22fe48 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/simple_refinement_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_refinement_config; -diff --git b/TestModels/Refinement/runtimes/rust/src/conversions/simple_refinement_config/_simple_refinement_config.rs a/TestModels/Refinement/runtimes/rust/src/conversions/simple_refinement_config/_simple_refinement_config.rs -new file mode 100644 -index 00000000..41e00dbe ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/conversions/simple_refinement_config/_simple_refinement_config.rs -@@ -0,0 +1,19 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::types::simple_refinement_config::SimpleRefinementConfig, -+) -> ::std::rc::Rc< -+ crate::simple::refinement::internaldafny::types::SimpleRefinementConfig, -+> { -+ ::std::rc::Rc::new(crate::r#simple::refinement::internaldafny::types::SimpleRefinementConfig::SimpleRefinementConfig {}) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::refinement::internaldafny::types::SimpleRefinementConfig, -+ >, -+) -> crate::types::simple_refinement_config::SimpleRefinementConfig { -+ crate::types::simple_refinement_config::SimpleRefinementConfig {} -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/error.rs a/TestModels/Refinement/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/Refinement/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/Refinement/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/Refinement/runtimes/rust/src/implementation_from_dafny.rs -index d9cc0581..6bcd1e00 100644 ---- b/TestModels/Refinement/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/Refinement/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,23 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+ -+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; -+mod standard_library_conversions; -+ -+pub use client::Client; -+pub use types::simple_refinement_config::SimpleRefinementConfig; -+ -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -diff --git b/TestModels/Refinement/runtimes/rust/src/lib.rs a/TestModels/Refinement/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..33ef356e ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/lib.rs -@@ -0,0 +1,19 @@ -+#![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_refinement_config::SimpleRefinementConfig; -diff --git b/TestModels/Refinement/runtimes/rust/src/operation.rs a/TestModels/Refinement/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..015f55f3 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation.rs -@@ -0,0 +1,13 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetRefinement` operation. -+pub mod get_refinement; -+ -+/// Types for the `OnlyInput` operation. -+pub mod only_input; -+ -+/// Types for the `OnlyOutput` operation. -+pub mod only_output; -+ -+// /// Types for the `ReadonlyOperation` operation. -+pub mod readonly_operation; -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/get_refinement.rs a/TestModels/Refinement/runtimes/rust/src/operation/get_refinement.rs -new file mode 100644 -index 00000000..6fe26ebe ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/get_refinement.rs -@@ -0,0 +1,147 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetRefinement`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetRefinement; -+impl GetRefinement { -+ /// Creates a new `GetRefinement` -+ pub fn new() -> Self { -+ Self -+ } -+ -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_refinement::GetRefinementInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_refinement::GetRefinementOutput, -+ crate::operation::get_refinement::GetRefinementError, -+ > { -+ let inner_input = -+ crate::conversions::get_refinement::_get_refinement_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetRefinement(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_refinement::_get_refinement_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_refinement::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetRefinement` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetRefinementError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetRefinementError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetRefinementError { -+ /// Creates the `GetRefinementError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetRefinementError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetRefinementError { -+ 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 GetRefinementError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetRefinementError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetRefinementError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetRefinementError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_refinement::_get_refinement_output::GetRefinementOutput; -+ -+pub use crate::operation::get_refinement::_get_refinement_input::GetRefinementInput; -+ -+mod _get_refinement_input; -+ -+mod _get_refinement_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/get_refinement/_get_refinement_input.rs a/TestModels/Refinement/runtimes/rust/src/operation/get_refinement/_get_refinement_input.rs -new file mode 100644 -index 00000000..d5a74762 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/get_refinement/_get_refinement_input.rs -@@ -0,0 +1,90 @@ -+// 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 GetRefinementInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub required_string: ::std::string::String, -+ #[allow(missing_docs)] // documentation missing in model -+ pub optional_string: ::std::option::Option<::std::string::String>, -+} -+impl GetRefinementInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn required_string(&self) -> &str { -+ &self.required_string -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn optional_string(&self) -> ::std::option::Option<&str> { -+ self.optional_string.as_deref() -+ } -+} -+impl GetRefinementInput { -+ /// Creates a new builder-style object to manufacture [`GetRefinementInput`](crate::operation::get_refinement::GetRefinementInput). -+ pub fn builder() -> crate::operation::get_refinement::builders::GetRefinementInputBuilder { -+ crate::operation::get_refinement::builders::GetRefinementInputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetRefinementInput`](crate::operation::get_refinement::GetRefinementInput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetRefinementInputBuilder { -+ pub(crate) required_string: ::std::option::Option<::std::string::String>, -+ pub(crate) optional_string: ::std::option::Option<::std::string::String>, -+} -+impl GetRefinementInputBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ /// This field is required. -+ pub fn required_string( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.required_string = ::std::option::Option::Some(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_required_string(&self) -> &::std::option::Option<::std::string::String> { -+ &self.required_string -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn optional_string( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.optional_string = ::std::option::Option::Some(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_optional_string( -+ mut self, -+ input: ::std::option::Option<::std::string::String>, -+ ) -> Self { -+ self.optional_string = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_optional_string(&self) -> &::std::option::Option<::std::string::String> { -+ &self.optional_string -+ } -+ /// Consumes the builder and constructs a [`GetRefinementInput`](crate::operation::get_refinement::GetRefinementInput). -+ /// This method will fail if any of the following fields are not set: -+ /// - [`required_string`](crate::operation::get_refinement::builders::GetRefinementInputBuilder::required_string) -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_refinement::GetRefinementInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_refinement::GetRefinementInput { -+ required_string: self.required_string.ok_or_else(|| { -+ ::aws_smithy_types::error::operation::BuildError::missing_field( -+ "required_string", -+ "required_string was not specified but it is required when building GetRefinementInput", -+ ) -+ })?, -+ optional_string: self.optional_string, -+ }) -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/get_refinement/_get_refinement_output.rs a/TestModels/Refinement/runtimes/rust/src/operation/get_refinement/_get_refinement_output.rs -new file mode 100644 -index 00000000..b4bc95ee ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/get_refinement/_get_refinement_output.rs -@@ -0,0 +1,99 @@ -+// 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 GetRefinementOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub required_string: ::std::string::String, -+ #[allow(missing_docs)] // documentation missing in model -+ pub optional_string: ::std::option::Option<::std::string::String>, -+} -+impl GetRefinementOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn required_string(&self) -> &str { -+ use std::ops::Deref; -+ self.required_string.deref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn optional_string(&self) -> ::std::option::Option<&str> { -+ self.optional_string.as_deref() -+ } -+} -+impl GetRefinementOutput { -+ /// Creates a new builder-style object to manufacture [`GetRefinementOutput`](crate::operation::get_refinement::GetRefinementOutput). -+ pub fn builder() -> crate::operation::get_refinement::builders::GetRefinementOutputBuilder { -+ crate::operation::get_refinement::builders::GetRefinementOutputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetRefinementOutput`](crate::operation::get_refinement::GetRefinementOutput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetRefinementOutputBuilder { -+ pub(crate) required_string: ::std::option::Option<::std::string::String>, -+ pub(crate) optional_string: ::std::option::Option<::std::string::String>, -+} -+impl GetRefinementOutputBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ /// This field is required. -+ pub fn required_string( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.required_string = ::std::option::Option::Some(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_required_string( -+ mut self, -+ input: ::std::option::Option<::std::string::String>, -+ ) -> Self { -+ self.required_string = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_required_string(&self) -> &::std::option::Option<::std::string::String> { -+ &self.required_string -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn optional_string( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.optional_string = ::std::option::Option::Some(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_optional_string( -+ mut self, -+ input: ::std::option::Option<::std::string::String>, -+ ) -> Self { -+ self.optional_string = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_optional_string(&self) -> &::std::option::Option<::std::string::String> { -+ &self.optional_string -+ } -+ /// Consumes the builder and constructs a [`GetRefinementOutput`](crate::operation::get_refinement::GetRefinementOutput). -+ /// This method will fail if any of the following fields are not set: -+ /// - [`required_string`](crate::operation::get_refinement::builders::GetRefinementOutputBuilder::required_string) -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_refinement::GetRefinementOutput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_refinement::GetRefinementOutput { -+ required_string: self.required_string.ok_or_else(|| { -+ ::aws_smithy_types::error::operation::BuildError::missing_field( -+ "required_string", -+ "required_string was not specified but it is required when building GetRefinementOutput", -+ ) -+ })?, -+ optional_string: self.optional_string, -+ }) -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/get_refinement/builders.rs a/TestModels/Refinement/runtimes/rust/src/operation/get_refinement/builders.rs -new file mode 100644 -index 00000000..8be68872 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/get_refinement/builders.rs -@@ -0,0 +1,92 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_refinement::_get_refinement_output::GetRefinementOutputBuilder; -+ -+pub use crate::operation::get_refinement::_get_refinement_input::GetRefinementInputBuilder; -+ -+impl GetRefinementInputBuilder { -+ /// 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_refinement::GetRefinementOutput, -+ crate::operation::get_refinement::GetRefinementError, -+ > { -+ let mut fluent_builder = client.get_refinement(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetRefinement`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetRefinementFluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::get_refinement::builders::GetRefinementInputBuilder, -+} -+impl GetRefinementFluentBuilder { -+ /// Creates a new `GetRefinement`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetRefinement as a reference. -+ pub fn as_input( -+ &self, -+ ) -> &crate::operation::get_refinement::builders::GetRefinementInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_refinement::GetRefinementOutput, -+ crate::operation::get_refinement::GetRefinementError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetRefinement 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_refinement::GetRefinementError::unhandled)?; -+ crate::operation::get_refinement::GetRefinement::send(&self.client, input).await -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn required_string( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.inner = self.inner.required_string(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_required_string(&self) -> &::std::option::Option<::std::string::String> { -+ self.inner.get_required_string() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn optional_string( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.inner = self.inner.optional_string(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_optional_string( -+ mut self, -+ input: ::std::option::Option<::std::string::String>, -+ ) -> Self { -+ self.inner = self.inner.set_optional_string(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_optional_string(&self) -> &::std::option::Option<::std::string::String> { -+ self.inner.get_optional_string() -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/only_input.rs a/TestModels/Refinement/runtimes/rust/src/operation/only_input.rs -new file mode 100644 -index 00000000..03ee1548 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/only_input.rs -@@ -0,0 +1,146 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `OnlyInput`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct OnlyInput; -+impl OnlyInput { -+ /// Creates a new `OnlyInput` -+ pub fn new() -> Self { -+ Self -+ } -+ -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::only_input::OnlyInputInput, -+ ) -> ::std::result::Result< -+ crate::operation::only_input::OnlyInputOutput, -+ crate::operation::only_input::OnlyInputError, -+ > { -+ let inner_input = crate::conversions::only_input::_only_input_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).OnlyInput(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::only_input::_only_input_output::from_dafny( -+ *inner_result.value(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::only_input::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `OnlyInput` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum OnlyInputError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-OnlyInputError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl OnlyInputError { -+ /// Creates the `OnlyInputError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `OnlyInputError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for OnlyInputError { -+ 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 OnlyInputError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for OnlyInputError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for OnlyInputError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for OnlyInputError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::only_input::_only_input_output::OnlyInputOutput; -+ -+pub use crate::operation::only_input::_only_input_input::OnlyInputInput; -+ -+mod _only_input_input; -+ -+mod _only_input_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/only_input/_only_input_input.rs a/TestModels/Refinement/runtimes/rust/src/operation/only_input/_only_input_input.rs -new file mode 100644 -index 00000000..616f73d1 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/only_input/_only_input_input.rs -@@ -0,0 +1,47 @@ -+// 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 OnlyInputInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option<::std::string::String>, -+} -+impl OnlyInputInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option<&str> { -+ self.value.as_deref() -+ } -+} -+impl OnlyInputInput { -+ /// Creates a new builder-style object to manufacture [`OnlyInputInput`](crate::operation::only_input::OnlyInputInput). -+ pub fn builder() -> crate::operation::only_input::builders::OnlyInputInputBuilder { -+ crate::operation::only_input::builders::OnlyInputInputBuilder::default() -+ } -+} -+ -+/// A builder for [`OnlyInputInput`](crate::operation::only_input::OnlyInputInput). -+#[non_exhaustive] -+#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] -+pub struct OnlyInputInputBuilder { -+ pub(crate) value: ::std::option::Option<::std::string::String>, -+} -+impl OnlyInputInputBuilder { -+ #[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 [`OnlyInputInput`](crate::operation::only_input::OnlyInputInput). -+ pub fn build(self) -> ::std::result::Result { -+ ::std::result::Result::Ok(crate::operation::only_input::OnlyInputInput { value: self.value }) -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/only_input/_only_input_output.rs a/TestModels/Refinement/runtimes/rust/src/operation/only_input/_only_input_output.rs -new file mode 100644 -index 00000000..0dd671a0 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/only_input/_only_input_output.rs -@@ -0,0 +1,22 @@ -+// 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 OnlyInputOutput {} -+impl OnlyInputOutput { -+ /// Creates a new builder-style object to manufacture [`OnlyInputOutput`](crate::operation::only_input::OnlyInputOutput). -+ pub fn builder() -> crate::operation::only_input::builders::OnlyInputOutputBuilder { -+ crate::operation::only_input::builders::OnlyInputOutputBuilder::default() -+ } -+} -+ -+/// A builder for [`OnlyInputOutput`](crate::operation::only_input::OnlyInputOutput). -+#[non_exhaustive] -+#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] -+pub struct OnlyInputOutputBuilder {} -+impl OnlyInputOutputBuilder { -+ /// Consumes the builder and constructs a [`OnlyInputOutput`](crate::operation::only_input::OnlyInputOutput). -+ pub fn build(self) -> crate::operation::only_input::OnlyInputOutput { -+ crate::operation::only_input::OnlyInputOutput {} -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/only_input/builders.rs a/TestModels/Refinement/runtimes/rust/src/operation/only_input/builders.rs -new file mode 100644 -index 00000000..9148352c ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/only_input/builders.rs -@@ -0,0 +1,72 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::only_input::_only_input_output::OnlyInputOutputBuilder; -+ -+pub use crate::operation::only_input::_only_input_input::OnlyInputInputBuilder; -+ -+impl crate::operation::only_input::builders::OnlyInputInputBuilder { -+ /// Sends a request with this input using the given client. -+ pub async fn send_with( -+ self, -+ client: &crate::Client, -+ ) -> ::std::result::Result< -+ crate::operation::only_input::OnlyInputOutput, -+ crate::operation::only_input::OnlyInputError, -+ > { -+ let mut fluent_builder = client.only_input(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `OnlyInput`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct OnlyInputFluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::only_input::builders::OnlyInputInputBuilder, -+} -+impl OnlyInputFluentBuilder { -+ /// Creates a new `OnlyInputFluentBuilder`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the OnlyInput as a reference. -+ pub fn as_input(&self) -> &crate::operation::only_input::builders::OnlyInputInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::only_input::OnlyInputOutput, -+ crate::operation::only_input::OnlyInputError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since OnlyInput 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::only_input::OnlyInputError::unhandled)?; -+ crate::operation::only_input::OnlyInput::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() -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/only_output.rs a/TestModels/Refinement/runtimes/rust/src/operation/only_output.rs -new file mode 100644 -index 00000000..0a815e21 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/only_output.rs -@@ -0,0 +1,143 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `OnlyOutput`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct OnlyOutput; -+impl OnlyOutput { -+ /// Creates a new `OnlyOutput` -+ pub fn new() -> Self { -+ Self -+ } -+ -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ ) -> ::std::result::Result< -+ crate::operation::only_output::OnlyOutputOutput, -+ crate::operation::only_output::OnlyOutputError, -+ > { -+ let inner_result = ::dafny_runtime::md!(client.dafny_client.clone()).OnlyOutput(); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::only_output::_only_output_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::only_output::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `OnlyOutput` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum OnlyOutputError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-OnlyOutputError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl OnlyOutputError { -+ /// Creates the `OnlyOutputError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `OnlyOutputError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for OnlyOutputError { -+ 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 OnlyOutputError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for OnlyOutputError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for OnlyOutputError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for OnlyOutputError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::only_output::_only_output_output::OnlyOutputOutput; -+ -+pub use crate::operation::only_output::_only_output_input::OnlyOutputInput; -+ -+mod _only_output_input; -+ -+mod _only_output_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/only_output/_only_output_input.rs a/TestModels/Refinement/runtimes/rust/src/operation/only_output/_only_output_input.rs -new file mode 100644 -index 00000000..4f81ca75 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/only_output/_only_output_input.rs -@@ -0,0 +1,29 @@ -+// 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 OnlyOutputInput {} -+impl OnlyOutputInput { -+ /// Creates a new builder-style object to manufacture [`OnlyOutputInput`](crate::operation::only_output::OnlyOutputInput). -+ pub fn builder() -> crate::operation::only_output::builders::OnlyOutputInputBuilder { -+ crate::operation::only_output::builders::OnlyOutputInputBuilder::default() -+ } -+} -+ -+/// A builder for [`OnlyOutputInput`](crate::operation::only_output::OnlyOutputInput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct OnlyOutputInputBuilder {} -+impl OnlyOutputInputBuilder { -+ /// Consumes the builder and constructs a [`OnlyOutputInput`](crate::operation::only_output::OnlyOutputInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::only_output::OnlyOutputInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::only_output::OnlyOutputInput {}) -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/only_output/_only_output_output.rs a/TestModels/Refinement/runtimes/rust/src/operation/only_output/_only_output_output.rs -new file mode 100644 -index 00000000..534e2acd ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/only_output/_only_output_output.rs -@@ -0,0 +1,49 @@ -+// 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 OnlyOutputOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option<::std::string::String>, -+} -+impl OnlyOutputOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option<&str> { -+ self.value.as_deref() -+ } -+} -+impl OnlyOutputOutput { -+ /// Creates a new builder-style object to manufacture [`OnlyOutputOutput`](crate::operation::only_output::OnlyOutputOutput). -+ pub fn builder() -> crate::operation::only_output::builders::OnlyOutputOutputBuilder { -+ crate::operation::only_output::builders::OnlyOutputOutputBuilder::default() -+ } -+} -+ -+/// A builder for [`OnlyOutputOutput`](crate::operation::only_output::OnlyOutputOutput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct OnlyOutputOutputBuilder { -+ pub(crate) value: ::std::option::Option<::std::string::String>, -+} -+impl OnlyOutputOutputBuilder { -+ #[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 [`OnlyOutputOutput`](crate::operation::only_output::OnlyOutputOutput). -+ pub fn build(self) -> crate::operation::only_output::OnlyOutputOutput { -+ crate::operation::only_output::OnlyOutputOutput { value: self.value } -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/only_output/builders.rs a/TestModels/Refinement/runtimes/rust/src/operation/only_output/builders.rs -new file mode 100644 -index 00000000..890d49af ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/only_output/builders.rs -@@ -0,0 +1,56 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::only_output::_only_output_output::OnlyOutputOutputBuilder; -+ -+pub use crate::operation::only_output::_only_output_input::OnlyOutputInputBuilder; -+ -+impl crate::operation::only_output::builders::OnlyOutputInputBuilder { -+ /// Sends a request with this input using the given client. -+ pub async fn send_with( -+ self, -+ client: &crate::Client, -+ ) -> ::std::result::Result< -+ crate::operation::only_output::OnlyOutputOutput, -+ crate::operation::only_output::OnlyOutputError, -+ > { -+ let mut fluent_builder = client.only_output(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `OnlyOutput`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct OnlyOutputFluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::only_output::builders::OnlyOutputInputBuilder, -+} -+ -+impl OnlyOutputFluentBuilder { -+ /// Creates a new `OnlyOutputFluentBuilder`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the OnlyOutput as a reference. -+ pub fn as_input(&self) -> &crate::operation::only_output::builders::OnlyOutputInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ /// -+ /// If an error occurs, an `SdkError` will be returned with additional details that -+ /// can be matched against. -+ /// -+ /// By default, any retryable failures will be retried twice. Retry behavior -+ /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be -+ /// set when configuring the client. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::only_output::OnlyOutputOutput, -+ crate::operation::only_output::OnlyOutputError, -+ > { -+ crate::operation::only_output::OnlyOutput::send(&self.client).await -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/readonly_operation.rs a/TestModels/Refinement/runtimes/rust/src/operation/readonly_operation.rs -new file mode 100644 -index 00000000..8940d4a3 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/readonly_operation.rs -@@ -0,0 +1,147 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `ReadonlyOperation`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct ReadonlyOperation; -+impl ReadonlyOperation { -+ /// Creates a new `ReadonlyOperation` -+ pub fn new() -> Self { -+ Self -+ } -+ -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::readonly_operation::ReadonlyOperationInput, -+ ) -> ::std::result::Result< -+ crate::operation::readonly_operation::ReadonlyOperationOutput, -+ crate::operation::readonly_operation::ReadonlyOperationError, -+ > { -+ let inner_input = -+ crate::conversions::readonly_operation::_readonly_operation_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).ReadonlyOperation(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::readonly_operation::_readonly_operation_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::readonly_operation::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `ReadonlyOperation` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum ReadonlyOperationError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ReadonlyOperationError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl ReadonlyOperationError { -+ /// Creates the `ReadonlyOperationError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `ReadonlyOperationError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for ReadonlyOperationError { -+ 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 ReadonlyOperationError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for ReadonlyOperationError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ReadonlyOperationError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ReadonlyOperationError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::readonly_operation::_readonly_operation_output::ReadonlyOperationOutput; -+ -+pub use crate::operation::readonly_operation::_readonly_operation_input::ReadonlyOperationInput; -+ -+mod _readonly_operation_input; -+ -+mod _readonly_operation_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/readonly_operation/_readonly_operation_input.rs a/TestModels/Refinement/runtimes/rust/src/operation/readonly_operation/_readonly_operation_input.rs -new file mode 100644 -index 00000000..ea363198 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/readonly_operation/_readonly_operation_input.rs -@@ -0,0 +1,99 @@ -+// 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 ReadonlyOperationInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub required_string: ::std::string::String, -+ #[allow(missing_docs)] // documentation missing in model -+ pub optional_string: ::std::option::Option<::std::string::String>, -+} -+impl ReadonlyOperationInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn required_string(&self) -> &str { -+ &self.required_string -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn optional_string(&self) -> ::std::option::Option<&str> { -+ self.optional_string.as_deref() -+ } -+} -+impl ReadonlyOperationInput { -+ /// Creates a new builder-style object to manufacture [`ReadonlyOperationInput`](crate::operation::readonly_operation::ReadonlyOperationInput). -+ pub fn builder() -> crate::operation::readonly_operation::builders::ReadonlyOperationInputBuilder -+ { -+ crate::operation::readonly_operation::builders::ReadonlyOperationInputBuilder::default() -+ } -+} -+ -+/// A builder for [`ReadonlyOperationInput`](crate::operation::readonly_operation::ReadonlyOperationInput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct ReadonlyOperationInputBuilder { -+ pub(crate) required_string: ::std::option::Option<::std::string::String>, -+ pub(crate) optional_string: ::std::option::Option<::std::string::String>, -+} -+impl ReadonlyOperationInputBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ /// This field is required. -+ pub fn required_string( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.required_string = ::std::option::Option::Some(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_required_string( -+ mut self, -+ input: ::std::option::Option<::std::string::String>, -+ ) -> Self { -+ self.required_string = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_required_string(&self) -> &::std::option::Option<::std::string::String> { -+ &self.required_string -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn optional_string( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.optional_string = ::std::option::Option::Some(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_optional_string( -+ mut self, -+ input: ::std::option::Option<::std::string::String>, -+ ) -> Self { -+ self.optional_string = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_optional_string(&self) -> &::std::option::Option<::std::string::String> { -+ &self.optional_string -+ } -+ /// Consumes the builder and constructs a [`ReadonlyOperationInput`](crate::operation::readonly_operation::ReadonlyOperationInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::readonly_operation::ReadonlyOperationInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok( -+ crate::operation::readonly_operation::ReadonlyOperationInput { -+ required_string: self.required_string.ok_or_else(|| { -+ ::aws_smithy_types::error::operation::BuildError::missing_field( -+ "required_string", -+ "required_string was not specified but it is required when building GetRefinementInput", -+ ) -+ })?, -+ optional_string: self.optional_string, -+ }, -+ ) -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/readonly_operation/_readonly_operation_output.rs a/TestModels/Refinement/runtimes/rust/src/operation/readonly_operation/_readonly_operation_output.rs -new file mode 100644 -index 00000000..3859d41f ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/readonly_operation/_readonly_operation_output.rs -@@ -0,0 +1,82 @@ -+// 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 ReadonlyOperationOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub required_string: ::std::string::String, -+ #[allow(missing_docs)] // documentation missing in model -+ pub optional_string: ::std::option::Option<::std::string::String>, -+} -+impl ReadonlyOperationOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn required_string(&self) -> &str { -+ use std::ops::Deref; -+ self.required_string.deref() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn optional_string(&self) -> ::std::option::Option<&str> { -+ self.optional_string.as_deref() -+ } -+} -+impl ReadonlyOperationOutput { -+ /// Creates a new builder-style object to manufacture [`ReadonlyOperationOutput`](crate::operation::readonly_operation::ReadonlyOperationOutput). -+ pub fn builder() -> crate::operation::readonly_operation::builders::ReadonlyOperationOutputBuilder { -+ crate::operation::readonly_operation::builders::ReadonlyOperationOutputBuilder::default() -+ } -+} -+ -+/// A builder for [`ReadonlyOperationOutput`](crate::operation::readonly_operation::ReadonlyOperationOutput). -+#[non_exhaustive] -+#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] -+pub struct ReadonlyOperationOutputBuilder { -+ pub(crate) required_string: ::std::option::Option<::std::string::String>, -+ pub(crate) optional_string: ::std::option::Option<::std::string::String>, -+} -+impl ReadonlyOperationOutputBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ /// This field is required. -+ pub fn required_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { -+ self.required_string = ::std::option::Option::Some(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_required_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self { -+ self.required_string = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_required_string(&self) -> &::std::option::Option<::std::string::String> { -+ &self.required_string -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn optional_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { -+ self.optional_string = ::std::option::Option::Some(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_optional_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self { -+ self.optional_string = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_optional_string(&self) -> &::std::option::Option<::std::string::String> { -+ &self.optional_string -+ } -+ /// Consumes the builder and constructs a [`ReadonlyOperationOutput`](crate::operation::readonly_operation::ReadonlyOperationOutput). -+ /// This method will fail if any of the following fields are not set: -+ /// - [`required_string`](crate::operation::readonly_operation::builders::ReadonlyOperationOutputBuilder::required_string) -+ pub fn build( -+ self, -+ ) -> ::std::result::Result { -+ ::std::result::Result::Ok(crate::operation::readonly_operation::ReadonlyOperationOutput { -+ required_string: self.required_string.ok_or_else(|| { -+ ::aws_smithy_types::error::operation::BuildError::missing_field( -+ "required_string", -+ "required_string was not specified but it is required when building ReadonlyOperationOutput", -+ ) -+ })?, -+ optional_string: self.optional_string, -+ }) -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/operation/readonly_operation/builders.rs a/TestModels/Refinement/runtimes/rust/src/operation/readonly_operation/builders.rs -new file mode 100644 -index 00000000..153306c8 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/operation/readonly_operation/builders.rs -@@ -0,0 +1,92 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::readonly_operation::_readonly_operation_output::ReadonlyOperationOutputBuilder; -+ -+pub use crate::operation::readonly_operation::_readonly_operation_input::ReadonlyOperationInputBuilder; -+ -+impl ReadonlyOperationInputBuilder { -+ /// Sends a request with this input using the given client. -+ pub async fn send_with( -+ self, -+ client: &crate::Client, -+ ) -> ::std::result::Result< -+ crate::operation::readonly_operation::ReadonlyOperationOutput, -+ crate::operation::readonly_operation::ReadonlyOperationError, -+ > { -+ let mut fluent_builder = client.readonly_operation(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `ReadonlyOperation`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct ReadonlyOperationFluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::readonly_operation::builders::ReadonlyOperationInputBuilder, -+} -+impl ReadonlyOperationFluentBuilder { -+ /// Creates a new `ReadonlyOperation`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the ReadonlyOperation as a reference. -+ pub fn as_input( -+ &self, -+ ) -> &crate::operation::readonly_operation::builders::ReadonlyOperationInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::readonly_operation::ReadonlyOperationOutput, -+ crate::operation::readonly_operation::ReadonlyOperationError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since ReadonlyOperation 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::readonly_operation::ReadonlyOperationError::unhandled)?; -+ crate::operation::readonly_operation::ReadonlyOperation::send(&self.client, input).await -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn required_string( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.inner = self.inner.required_string(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_required_string(&self) -> &::std::option::Option<::std::string::String> { -+ self.inner.get_required_string() -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn optional_string( -+ mut self, -+ input: impl ::std::convert::Into<::std::string::String>, -+ ) -> Self { -+ self.inner = self.inner.optional_string(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_optional_string( -+ mut self, -+ input: ::std::option::Option<::std::string::String>, -+ ) -> Self { -+ self.inner = self.inner.set_optional_string(input); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_optional_string(&self) -> &::std::option::Option<::std::string::String> { -+ self.inner.get_optional_string() -+ } -+} -diff --git b/TestModels/Refinement/runtimes/rust/src/standard_library_conversions.rs a/TestModels/Refinement/runtimes/rust/src/standard_library_conversions.rs -new file mode 100644 -index 00000000..2fec0ffb ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/standard_library_conversions.rs -@@ -0,0 +1,246 @@ -+pub fn ostring_to_dafny( -+ input: &Option, -+) -> ::std::rc::Rc< -+ 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 {}, -+}; -+ ::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>>, -+ >, -+) -> 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 -+ } -+} -+ -+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 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) -+} -+ -+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 -+ } -+} -+ -+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 blob_to_dafny( -+ input: &::aws_smithy_types::Blob, -+) -> ::dafny_runtime::Sequence { -+ ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) -+} -+ -+pub fn oblob_to_dafny( -+ 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) -+} -+ -+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>>, -+) -> Option<::aws_smithy_types::Blob> { -+ 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 odouble_to_dafny( -+ 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) -+} -+ -+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>>, -+) -> Option { -+ 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, -+) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { -+ ::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) -+} -+ -+pub fn timestamp_from_dafny( -+ 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() -+} -+ -+pub fn otimestamp_from_dafny( -+ input: ::std::rc::Rc>>, -+) -> Option<::aws_smithy_types::DateTime> { -+ 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, -+) -> Option { -+ 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, -+) -> ::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 {} -+ ), -+ } -+} -+ -+pub fn result_from_dafny( -+ 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)), -+ } -+} -+ -+pub fn result_to_dafny( -+ 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 -diff --git b/TestModels/Refinement/runtimes/rust/src/types.rs a/TestModels/Refinement/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..2612ec35 ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/types.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `SimpleRefinementConfig` -+pub mod simple_refinement_config; -diff --git b/TestModels/Refinement/runtimes/rust/src/types/simple_refinement_config.rs a/TestModels/Refinement/runtimes/rust/src/types/simple_refinement_config.rs -new file mode 100644 -index 00000000..1263ea8a ---- /dev/null -+++ a/TestModels/Refinement/runtimes/rust/src/types/simple_refinement_config.rs -@@ -0,0 +1,28 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleRefinementConfig {} -+ -+impl SimpleRefinementConfig { -+ pub fn builder() -> SimpleRefinementConfigBuilder { -+ SimpleRefinementConfigBuilder::new() -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleRefinementConfigBuilder {} -+ -+impl SimpleRefinementConfigBuilder { -+ /// Creates a new `SimpleRefinementConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self {} -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ SimpleRefinementConfig, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(SimpleRefinementConfig {}) -+ } -+} diff --git a/TestModels/Refinement/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/Refinement/runtimes/rust/src/implementation_from_dafny.rs index 6bcd1e002..624683854 100644 --- a/TestModels/Refinement/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/Refinement/runtimes/rust/src/implementation_from_dafny.rs @@ -1,7 +1,6 @@ #![allow(warnings, unconditional_panic)] #![allow(nonstandard_style)] - pub mod client; pub mod types; @@ -14,10 +13,12 @@ pub mod operation; mod conversions; mod standard_library_conversions; +#[cfg(feature = "wrapped-client")] +pub mod wrapped; + pub use client::Client; pub use types::simple_refinement_config::SimpleRefinementConfig; - pub mod r#_Wrappers_Compile { pub use dafny_runtime::DafnyPrint; pub use std::cmp::Eq; diff --git a/TestModels/Resource/Makefile b/TestModels/Resource/Makefile index a462982da..3b260434e 100644 --- a/TestModels/Resource/Makefile +++ b/TestModels/Resource/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../SharedMakefile.mk NAMESPACE=simple.resources diff --git a/TestModels/Resource/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/Resource/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index 023a075ac..000000000 --- a/TestModels/Resource/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,2016 +0,0 @@ -diff --git b/TestModels/Resource/runtimes/rust/src/client.rs a/TestModels/Resource/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..593b1051 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/client.rs -@@ -0,0 +1,39 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ pub fn from_conf( -+ conf: crate::types::simple_resources_config::SimpleResourcesConfig, -+ ) -> Result { -+ let inner = -+ crate::simple::resources::internaldafny::_default::SimpleResources( -+ &crate::conversions::simple_resources_config::_simple_resources_config::to_dafny( -+ conf, -+ ), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+mod get_resources; -diff --git b/TestModels/Resource/runtimes/rust/src/client/get_resources.rs a/TestModels/Resource/runtimes/rust/src/client/get_resources.rs -new file mode 100644 -index 00000000..ee8ae97f ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/client/get_resources.rs -@@ -0,0 +1,15 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetResources`](crate::operation::get_resources::builders::GetResourcesFluentBuilder) operation. -+ /// -+ /// - The fluent builder is configurable: -+ /// - [`value(impl Into>)`](crate::operation::get_resources::builders::GetResourcesFluentBuilder::name) / [`set_name(Option)`](crate::operation::get_resources::builders::GetResourcesFluentBuilder::set_name):(undocumented)
-+ /// - On success, responds with [`GetResourcesOutput`](crate::operation::get_resources::GetResourcesOutput) with field(s): -+ /// - [`value(Option)`](crate::operation::get_resources::GetResourcesOutput::value): (undocumented) -+ /// - On failure, responds with [`SdkError`](crate::operation::get_resources::GetResourcesError) -+ pub fn get_resources( -+ &self, -+ ) -> crate::operation::get_resources::builders::GetResourcesFluentBuilder { -+ crate::operation::get_resources::builders::GetResourcesFluentBuilder::new(self.clone()) -+ } -+} -diff --git b/TestModels/Resource/runtimes/rust/src/conversions.rs a/TestModels/Resource/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..6db43c2c ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/conversions.rs -@@ -0,0 +1,6 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_resources; -+ -+pub mod get_resource_data; -+ -+pub mod simple_resources_config; -diff --git b/TestModels/Resource/runtimes/rust/src/conversions/get_resource_data.rs a/TestModels/Resource/runtimes/rust/src/conversions/get_resource_data.rs -new file mode 100644 -index 00000000..ec6cd5b2 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/conversions/get_resource_data.rs -@@ -0,0 +1,32 @@ -+// 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_resource_data::GetResourceDataError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_resource_data::GetResourceDataError::Unhandled(unhandled) => -+ ::std::rc::Rc::new(crate::r#simple::resources::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::resources::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_resource_data::GetResourceDataError { -+ // 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::resources::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_resource_data::GetResourceDataError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_resource_data::GetResourceDataError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_resource_data_input; -+ -+pub mod _get_resource_data_output; -diff --git b/TestModels/Resource/runtimes/rust/src/conversions/get_resource_data/_get_resource_data_input.rs a/TestModels/Resource/runtimes/rust/src/conversions/get_resource_data/_get_resource_data_input.rs -new file mode 100644 -index 00000000..3c8f9f69 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/conversions/get_resource_data/_get_resource_data_input.rs -@@ -0,0 +1,39 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_resource_data::GetResourceDataInput, -+) -> ::std::rc::Rc< -+ crate::r#simple::resources::internaldafny::types::GetResourceDataInput, -+> { -+ ::std::rc::Rc::new(crate::r#simple::resources::internaldafny::types::GetResourceDataInput::GetResourceDataInput { -+ stringValue: crate::standard_library_conversions::ostring_to_dafny(value.string_value()), -+ booleanValue: crate::standard_library_conversions::obool_to_dafny(value.boolean_value()), -+ integerValue: crate::standard_library_conversions::oint_to_dafny(value.integer_value()), -+ longValue: crate::standard_library_conversions::olong_to_dafny(value.long_value()), -+ blobValue: crate::standard_library_conversions::oblob_to_dafny(value.blob_value()) -+ }) -+} -+// _get_resource_data_Input -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::resources::internaldafny::types::GetResourceDataInput, -+ >, -+) -> crate::operation::get_resource_data::GetResourceDataInput { -+ match &*dafny_value { -+ crate::r#simple::resources::internaldafny::types::GetResourceDataInput::GetResourceDataInput { -+ blobValue, -+ booleanValue, -+ integerValue, -+ longValue, -+ stringValue, -+ } => -+ crate::operation::get_resource_data::GetResourceDataInput { -+ string_value: crate::standard_library_conversions::ostring_from_dafny(stringValue.clone()), -+ boolean_value: crate::standard_library_conversions::obool_from_dafny(booleanValue.clone()), -+ integer_value: crate::standard_library_conversions::oint_from_dafny(integerValue.clone()), -+ long_value: crate::standard_library_conversions::olong_from_dafny(longValue.clone()), -+ blob_value: crate::standard_library_conversions::oblob_from_dafny(blobValue.clone()) -+ } -+ } -+} -diff --git b/TestModels/Resource/runtimes/rust/src/conversions/get_resource_data/_get_resource_data_output.rs a/TestModels/Resource/runtimes/rust/src/conversions/get_resource_data/_get_resource_data_output.rs -new file mode 100644 -index 00000000..514edbdb ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/conversions/get_resource_data/_get_resource_data_output.rs -@@ -0,0 +1,39 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_resource_data::GetResourceDataOutput, -+) -> ::std::rc::Rc< -+ crate::r#simple::resources::internaldafny::types::GetResourceDataOutput, -+> { -+ ::std::rc::Rc::new(crate::r#simple::resources::internaldafny::types::GetResourceDataOutput::GetResourceDataOutput { -+ stringValue: crate::standard_library_conversions::ostring_to_dafny(value.string_value()), -+ booleanValue: crate::standard_library_conversions::obool_to_dafny(value.boolean_value()), -+ integerValue: crate::standard_library_conversions::oint_to_dafny(value.integer_value()), -+ longValue: crate::standard_library_conversions::olong_to_dafny(value.long_value()), -+ blobValue: crate::standard_library_conversions::oblob_to_dafny(value.blob_value()) -+ }) -+} -+// _get_resource_data_output -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::resources::internaldafny::types::GetResourceDataOutput, -+ >, -+) -> crate::operation::get_resource_data::GetResourceDataOutput { -+ match &*dafny_value { -+ crate::r#simple::resources::internaldafny::types::GetResourceDataOutput::GetResourceDataOutput { -+ blobValue, -+ booleanValue, -+ integerValue, -+ longValue, -+ stringValue, -+ } => -+ crate::operation::get_resource_data::GetResourceDataOutput { -+ string_value: crate::standard_library_conversions::ostring_from_dafny(stringValue.clone()), -+ boolean_value: crate::standard_library_conversions::obool_from_dafny(booleanValue.clone()), -+ integer_value: crate::standard_library_conversions::oint_from_dafny(integerValue.clone()), -+ long_value: crate::standard_library_conversions::olong_from_dafny(longValue.clone()), -+ blob_value: crate::standard_library_conversions::oblob_from_dafny(blobValue.clone()) -+ } -+ } -+} -diff --git b/TestModels/Resource/runtimes/rust/src/conversions/get_resources.rs a/TestModels/Resource/runtimes/rust/src/conversions/get_resources.rs -new file mode 100644 -index 00000000..1cffc46a ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/conversions/get_resources.rs -@@ -0,0 +1,32 @@ -+// 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_resources::GetResourcesError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_resources::GetResourcesError::Unhandled(unhandled) => -+ ::std::rc::Rc::new(crate::r#simple::resources::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::resources::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_resources::GetResourcesError { -+ // 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::resources::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_resources::GetResourcesError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_resources::GetResourcesError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_resources_input; -+ -+pub mod _get_resources_output; -diff --git b/TestModels/Resource/runtimes/rust/src/conversions/get_resources/_get_resources_input.rs a/TestModels/Resource/runtimes/rust/src/conversions/get_resources/_get_resources_input.rs -new file mode 100644 -index 00000000..95e17091 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/conversions/get_resources/_get_resources_input.rs -@@ -0,0 +1,43 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_resources::GetResourcesInput, -+) -> ::std::rc::Rc< -+ crate::r#simple::resources::internaldafny::types::GetResourcesInput, -+> { -+ let dafny_value = match value.value { -+ 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(crate::r#simple::resources::internaldafny::types::GetResourcesInput::GetResourcesInput { -+ value: ::std::rc::Rc::new(dafny_value) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::resources::internaldafny::types::GetResourcesInput, -+ >, -+) -> crate::operation::get_resources::GetResourcesInput { -+ 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_resources::GetResourcesInput { value } -+} -diff --git b/TestModels/Resource/runtimes/rust/src/conversions/get_resources/_get_resources_output.rs a/TestModels/Resource/runtimes/rust/src/conversions/get_resources/_get_resources_output.rs -new file mode 100644 -index 00000000..294b93b5 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/conversions/get_resources/_get_resources_output.rs -@@ -0,0 +1,111 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+use crate::types::simple_resource::SimpleResource; -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_resources::GetResourcesOutput, -+) -> ::std::rc::Rc< -+ crate::r#simple::resources::internaldafny::types::GetResourcesOutput, -+> { -+ let wrap = SimpleResourceWrapper { -+ obj: value.output.clone(), -+ }; -+ let inner : ::std::rc::Rc<::std::cell::UnsafeCell> -+ = ::std::rc::Rc::new(::std::cell::UnsafeCell::new(wrap)); -+ -+ ::std::rc::Rc::new(crate::r#simple::resources::internaldafny::types::GetResourcesOutput::GetResourcesOutput { -+ output: ::dafny_runtime::Object (Some(inner) ) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::resources::internaldafny::types::GetResourcesOutput, -+ >, -+) -> crate::operation::get_resources::GetResourcesOutput { -+ let wrap = SimpleResourceDafnyWrapper { -+ obj: dafny_value.output().clone(), -+ }; -+ crate::operation::get_resources::GetResourcesOutput { -+ output: ::std::rc::Rc::new(::std::cell::RefCell::new(wrap)), -+ } -+} -+ -+pub struct SimpleResourceWrapper { -+ obj: crate::types::simple_resource::SimpleResourceRef, -+} -+ -+impl ::dafny_runtime::UpcastObject for SimpleResourceWrapper { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -+ -+impl crate::r#simple::resources::internaldafny::types::ISimpleResource -+ for SimpleResourceWrapper -+{ -+ fn r#_GetResourceData_k( -+ &mut self, -+ input: &::std::rc::Rc< -+ crate::r#simple::resources::internaldafny::types::GetResourceDataInput, -+ >, -+ ) -> ::std::rc::Rc< -+ crate::r#_Wrappers_Compile::Result< -+ ::std::rc::Rc< -+ crate::r#simple::resources::internaldafny::types::GetResourceDataOutput, -+ >, -+ ::std::rc::Rc, -+ >, -+ > -+ { -+ let inner_input = -+ crate::conversions::get_resource_data::_get_resource_data_input::from_dafny( -+ input.clone(), -+ ); -+ let inner_result = self.obj.borrow_mut().get_resource_data(inner_input); -+ let result = match inner_result { -+ Ok(x) => crate::r#_Wrappers_Compile::Result::Success { -+ value: crate::conversions::get_resource_data::_get_resource_data_output::to_dafny( -+ x, -+ ), -+ }, -+ Err(x) => crate::r#_Wrappers_Compile::Result::Failure { -+ error: crate::conversions::get_resource_data::to_dafny_error(x), -+ }, -+ }; -+ ::std::rc::Rc::new(result) -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -+pub struct SimpleResourceDafnyWrapper { -+ pub(crate) obj: ::dafny_runtime::Object< -+ dyn crate::r#simple::resources::internaldafny::types::ISimpleResource, -+ >, -+} -+ -+impl SimpleResource for SimpleResourceDafnyWrapper { -+ fn get_resource_data( -+ &mut self, -+ input: crate::operation::get_resource_data::GetResourceDataInput, -+ ) -> Result< -+ crate::operation::get_resource_data::GetResourceDataOutput, -+ crate::operation::get_resource_data::GetResourceDataError, -+ > { -+ let inner_input = -+ crate::conversions::get_resource_data::_get_resource_data_input::to_dafny(input); -+ let inner_result = ::dafny_runtime::md!(self.obj.clone()).GetResourceData(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_resource_data::_get_resource_data_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_resource_data::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -diff --git b/TestModels/Resource/runtimes/rust/src/conversions/simple_resources_config.rs a/TestModels/Resource/runtimes/rust/src/conversions/simple_resources_config.rs -new file mode 100644 -index 00000000..5121f1c0 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/conversions/simple_resources_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_resources_config; -diff --git b/TestModels/Resource/runtimes/rust/src/conversions/simple_resources_config/_simple_resources_config.rs a/TestModels/Resource/runtimes/rust/src/conversions/simple_resources_config/_simple_resources_config.rs -new file mode 100644 -index 00000000..33886d22 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/conversions/simple_resources_config/_simple_resources_config.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::types::simple_resources_config::SimpleResourcesConfig, -+) -> ::std::rc::Rc< -+ crate::simple::resources::internaldafny::types::SimpleResourcesConfig, -+> { -+ let inner = crate::r#simple::resources::internaldafny::types::SimpleResourcesConfig::SimpleResourcesConfig { -+ name : dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&value.name) -+ }; -+ ::std::rc::Rc::new(inner) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::resources::internaldafny::types::SimpleResourcesConfig, -+ >, -+) -> crate::types::simple_resources_config::SimpleResourcesConfig { -+ crate::types::simple_resources_config::SimpleResourcesConfig { -+ name: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( -+ &dafny_value.name(), -+ ), -+ } -+} -diff --git b/TestModels/Resource/runtimes/rust/src/error.rs a/TestModels/Resource/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/Resource/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/Resource/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/Resource/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/Resource/runtimes/rust/src/implementation_from_dafny.rs -index 8b7375ca..d698ebfd 100644 ---- b/TestModels/Resource/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/Resource/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,22 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+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; -+mod standard_library_conversions; -+ -+pub use client::Client; -+pub use types::simple_resources_config::SimpleResourcesConfig; -+ -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -@@ -1380,13 +1396,13 @@ pub mod simple { - >, - >::new(); - let mut internalConfig: ::std::rc::Rc< -- crate::r#_SimpleResourcesOperations_Compile::Config, -+ crate::r#simpleResourcesOperations_Compile::Config, - > = ::std::rc::Rc::new( -- crate::r#_SimpleResourcesOperations_Compile::Config::Config { -+ crate::r#simpleResourcesOperations_Compile::Config::Config { - name: config.name().clone(), - }, - ); -- if crate::r#_SimpleResourcesOperations_Compile::_default::r#_ValidInternalConfig_q(&internalConfig) { -+ if crate::r#simpleResourcesOperations_Compile::_default::r#_ValidInternalConfig_q(&internalConfig) { - let mut client = ::dafny_runtime::MaybePlacebo::<::dafny_runtime::Object>::new(); - let mut _nw2: ::dafny_runtime::Object = crate::simple::resources::internaldafny::SimpleResourcesClient::_allocate_object(); - crate::simple::resources::internaldafny::SimpleResourcesClient::_ctor(&_nw2, &internalConfig); -@@ -1419,7 +1435,7 @@ pub mod simple { - - pub struct SimpleResourcesClient { - pub r#__i_config: -- ::std::rc::Rc, -+ ::std::rc::Rc, - } - - impl SimpleResourcesClient { -@@ -1430,7 +1446,7 @@ pub mod simple { - this: &::dafny_runtime::Object< - crate::simple::resources::internaldafny::SimpleResourcesClient, - >, -- config: &::std::rc::Rc, -+ config: &::std::rc::Rc, - ) -> () { - let mut _set__i_config: bool = false; - ::dafny_runtime::update_field_uninit_object!( -@@ -1443,7 +1459,7 @@ pub mod simple { - } - pub fn config( - &self, -- ) -> ::std::rc::Rc -+ ) -> ::std::rc::Rc - { - self.r#__i_config.clone() - } -@@ -1470,7 +1486,7 @@ pub mod simple { - 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#_SimpleResourcesOperations_Compile::_default::GetResources( -+ crate::r#simpleResourcesOperations_Compile::_default::GetResources( - &self.config().clone(), - input, - ), -@@ -2358,7 +2374,7 @@ pub mod simple { - } - } - } --pub mod r#_SimpleResource_Compile { -+pub mod r#simpleResource_Compile { - pub use crate::simple::resources::internaldafny::types::ISimpleResource; - pub use dafny_runtime::UpcastObject; - pub use std::any::Any; -@@ -2377,7 +2393,7 @@ pub mod r#_SimpleResource_Compile { - ::dafny_runtime::allocate_object::() - } - pub fn _ctor( -- this: &::dafny_runtime::Object, -+ this: &::dafny_runtime::Object, - value: &::std::rc::Rc< - crate::r#_Wrappers_Compile::Option< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, -@@ -2481,7 +2497,7 @@ pub mod r#_SimpleResource_Compile { - ::dafny_runtime::UpcastObjectFn!(dyn crate::simple::resources::internaldafny::types::ISimpleResource); - } - } --pub mod r#_SimpleResourcesOperations_Compile { -+pub mod r#simpleResourcesOperations_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; - pub use std::convert::AsRef; -@@ -2493,12 +2509,12 @@ pub mod r#_SimpleResourcesOperations_Compile { - - impl _default { - pub fn r#_ValidInternalConfig_q( -- config: &::std::rc::Rc, -+ config: &::std::rc::Rc, - ) -> bool { - true && ::dafny_runtime::int!(0) < config.name().cardinality() - } - pub fn GetResources( -- config: &::std::rc::Rc, -+ config: &::std::rc::Rc, - input: &::std::rc::Rc< - crate::simple::resources::internaldafny::types::GetResourcesInput, - >, -@@ -2519,19 +2535,19 @@ pub mod r#_SimpleResourcesOperations_Compile { - >, - >::new(); - let mut resource = ::dafny_runtime::MaybePlacebo::< -- ::dafny_runtime::Object, -+ ::dafny_runtime::Object, - >::new(); - let mut _nw1: ::dafny_runtime::Object< -- crate::r#_SimpleResource_Compile::SimpleResource, -- > = crate::r#_SimpleResource_Compile::SimpleResource::_allocate_object(); -- crate::r#_SimpleResource_Compile::SimpleResource::_ctor( -+ crate::r#simpleResource_Compile::SimpleResource, -+ > = crate::r#simpleResource_Compile::SimpleResource::_allocate_object(); -+ crate::r#simpleResource_Compile::SimpleResource::_ctor( - &_nw1, - input.value(), - config.name(), - ); - resource = ::dafny_runtime::MaybePlacebo::from(_nw1.clone()); - let mut result: ::std::rc::Rc = ::std::rc::Rc::new(crate::simple::resources::internaldafny::types::GetResourcesOutput::GetResourcesOutput { -- output: ::dafny_runtime::upcast_object::()(resource.read()) -+ output: ::dafny_runtime::upcast_object::()(resource.read()) - }); - output = ::dafny_runtime::MaybePlacebo::from(::std::rc::Rc::new( - crate::r#_Wrappers_Compile::Result::< -diff --git b/TestModels/Resource/runtimes/rust/src/lib.rs a/TestModels/Resource/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..7d3dac61 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/lib.rs -@@ -0,0 +1,19 @@ -+#![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_resources_config::SimpleResourcesConfig; -diff --git b/TestModels/Resource/runtimes/rust/src/operation.rs a/TestModels/Resource/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..e1af7f63 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/operation.rs -@@ -0,0 +1,5 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod get_resource_data; -+/// Types for the `GetResources` operation. -+pub mod get_resources; -diff --git b/TestModels/Resource/runtimes/rust/src/operation/get_resource_data.rs a/TestModels/Resource/runtimes/rust/src/operation/get_resource_data.rs -new file mode 100644 -index 00000000..ba2a8a6e ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/operation/get_resource_data.rs -@@ -0,0 +1,130 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetResourceData`. -+ -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetResourceData; -+impl GetResourceData { -+ /// Creates a new `GetResourceData` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: crate::types::simple_resource::SimpleResourceRef, -+ input: crate::operation::get_resource_data::GetResourceDataInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_resource_data::GetResourceDataOutput, -+ crate::operation::get_resource_data::GetResourceDataError, -+ > { -+ client.borrow_mut().get_resource_data(input) -+ } -+} -+ -+/// Error type for the `GetResourceData` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetResourceDataError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetResourceDataError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetResourceDataError { -+ /// Creates the `GetResourceDataError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetResourceDataError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetResourceDataError { -+ 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 GetResourceDataError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetResourceDataError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetResourceDataError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetResourceDataError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_resource_data::_get_resource_data_output::GetResourceDataOutput; -+ -+pub use crate::operation::get_resource_data::_get_resource_data_input::GetResourceDataInput; -+ -+mod _get_resource_data_input; -+ -+mod _get_resource_data_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/Resource/runtimes/rust/src/operation/get_resource_data/_get_resource_data_input.rs a/TestModels/Resource/runtimes/rust/src/operation/get_resource_data/_get_resource_data_input.rs -new file mode 100644 -index 00000000..58c53177 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/operation/get_resource_data/_get_resource_data_input.rs -@@ -0,0 +1,157 @@ -+// 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 GetResourceDataInput { -+ pub(crate) blob_value: Option, -+ pub(crate) boolean_value: Option, -+ pub(crate) string_value: Option, -+ pub(crate) integer_value: Option, -+ pub(crate) long_value: Option, -+} -+ -+impl GetResourceDataInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn blob_value(&self) -> &Option { -+ &self.blob_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn boolean_value(&self) -> Option { -+ self.boolean_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn string_value(&self) -> &Option { -+ &self.string_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn integer_value(&self) -> Option { -+ self.integer_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn long_value(&self) -> Option { -+ self.long_value -+ } -+} -+ -+impl GetResourceDataInput { -+ /// Creates a new builder-style object to manufacture [`GetResourceDataInput`](crate::operation::operation::GetResourceDataInput). -+ pub fn builder() -> crate::operation::get_resource_data::builders::GetResourceDataInputBuilder { -+ crate::operation::get_resource_data::builders::GetResourceDataInputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetResourceDataInput`](crate::operation::operation::GetResourceDataInput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetResourceDataInputBuilder { -+ blob_value: Option, -+ boolean_value: Option, -+ string_value: Option, -+ integer_value: Option, -+ long_value: Option, -+} -+ -+impl GetResourceDataInputBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn blob_value(mut self, input: aws_smithy_types::Blob) -> Self { -+ self.blob_value = Some(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_blob_value(mut self, input: Option) -> Self { -+ self.blob_value = input; -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_blob_value(&self) -> &Option { -+ &self.blob_value -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn boolean_value(mut self, input: bool) -> Self { -+ self.boolean_value = Some(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_boolean_value(mut self, input: Option) -> Self { -+ self.boolean_value = input; -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_boolean_value(&self) -> Option { -+ self.boolean_value -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn string_value(mut self, input: String) -> Self { -+ self.string_value = Some(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_string_value(mut self, input: Option) -> Self { -+ self.string_value = input; -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_string_value(&self) -> &Option { -+ &self.string_value -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn integer_value(mut self, input: i32) -> Self { -+ self.integer_value = Some(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_integer_value(mut self, input: Option) -> Self { -+ self.integer_value = input; -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_integer_value(&self) -> Option { -+ self.integer_value -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn long_value(mut self, input: i64) -> Self { -+ self.long_value = Some(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_long_value(mut self, input: Option) -> Self { -+ self.long_value = input; -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_long_value(&self) -> Option { -+ self.long_value -+ } -+ -+ /// Consumes the builder and constructs a [`GetResourceDataInput`](crate::operation::operation::GetResourceDataInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_resource_data::GetResourceDataInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_resource_data::GetResourceDataInput { -+ blob_value: self.blob_value, -+ boolean_value: self.boolean_value, -+ string_value: self.string_value, -+ integer_value: self.integer_value, -+ long_value: self.long_value, -+ }) -+ } -+} -diff --git b/TestModels/Resource/runtimes/rust/src/operation/get_resource_data/_get_resource_data_output.rs a/TestModels/Resource/runtimes/rust/src/operation/get_resource_data/_get_resource_data_output.rs -new file mode 100644 -index 00000000..1814e59f ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/operation/get_resource_data/_get_resource_data_output.rs -@@ -0,0 +1,158 @@ -+// 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 GetResourceDataOutput { -+ pub(crate) blob_value: Option, -+ pub(crate) boolean_value: Option, -+ pub(crate) string_value: Option, -+ pub(crate) integer_value: Option, -+ pub(crate) long_value: Option, -+} -+ -+impl GetResourceDataOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn blob_value(&self) -> &Option { -+ &self.blob_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn boolean_value(&self) -> Option { -+ self.boolean_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn string_value(&self) -> &Option { -+ &self.string_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn integer_value(&self) -> Option { -+ self.integer_value -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn long_value(&self) -> Option { -+ self.long_value -+ } -+} -+ -+impl GetResourceDataOutput { -+ /// Creates a new builder-style object to manufacture [`GetResourceDataOutput`](crate::operation::operation::GetResourceDataOutput). -+ pub fn builder() -> crate::operation::get_resource_data::builders::GetResourceDataOutputBuilder -+ { -+ crate::operation::get_resource_data::builders::GetResourceDataOutputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetResourceDataOutput`](crate::operation::operation::GetResourceDataOutput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetResourceDataOutputBuilder { -+ blob_value: Option, -+ boolean_value: Option, -+ string_value: Option, -+ integer_value: Option, -+ long_value: Option, -+} -+ -+impl GetResourceDataOutputBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn blob_value(mut self, input: aws_smithy_types::Blob) -> Self { -+ self.blob_value = Some(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_blob_value(mut self, input: Option) -> Self { -+ self.blob_value = input; -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_blob_value(&self) -> &Option { -+ &self.blob_value -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn boolean_value(mut self, input: bool) -> Self { -+ self.boolean_value = Some(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_boolean_value(mut self, input: Option) -> Self { -+ self.boolean_value = input; -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_boolean_value(&self) -> Option { -+ self.boolean_value -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn string_value(mut self, input: String) -> Self { -+ self.string_value = Some(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_string_value(mut self, input: Option) -> Self { -+ self.string_value = input; -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_string_value(&self) -> &Option { -+ &self.string_value -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn integer_value(mut self, input: i32) -> Self { -+ self.integer_value = Some(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_integer_value(mut self, input: Option) -> Self { -+ self.integer_value = input; -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_integer_value(&self) -> Option { -+ self.integer_value -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn long_value(mut self, input: i64) -> Self { -+ self.long_value = Some(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_long_value(mut self, input: Option) -> Self { -+ self.long_value = input; -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_long_value(&self) -> Option { -+ self.long_value -+ } -+ -+ /// Consumes the builder and constructs a [`GetResourceDataOutput`](crate::operation::operation::GetResourceDataOutput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_resource_data::GetResourceDataOutput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_resource_data::GetResourceDataOutput { -+ blob_value: self.blob_value, -+ boolean_value: self.boolean_value, -+ string_value: self.string_value, -+ integer_value: self.integer_value, -+ long_value: self.long_value, -+ }) -+ } -+} -diff --git b/TestModels/Resource/runtimes/rust/src/operation/get_resource_data/builders.rs a/TestModels/Resource/runtimes/rust/src/operation/get_resource_data/builders.rs -new file mode 100644 -index 00000000..9c1c4890 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/operation/get_resource_data/builders.rs -@@ -0,0 +1,148 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_resource_data::_get_resource_data_output::GetResourceDataOutputBuilder; -+ -+pub use crate::operation::get_resource_data::_get_resource_data_input::GetResourceDataInputBuilder; -+ -+impl GetResourceDataInputBuilder { -+ /// Sends a request with this input using the given client. -+ pub async fn send_with( -+ self, -+ client: crate::types::simple_resource::SimpleResourceRef, -+ ) -> ::std::result::Result< -+ crate::operation::get_resource_data::GetResourceDataOutput, -+ crate::operation::get_resource_data::GetResourceDataError, -+ > { -+ // FIXME - how to convert BuildError to GetResourceDataError -+ let input = self.build().unwrap(); -+ // let mut fluent_builder = client.borrow_mut().get_resource_data(); -+ // fluent_builder.inner = self; -+ // fluent_builder.send().await -+ client.borrow_mut().get_resource_data(input) -+ } -+} -+/// Fluent builder constructing a request to `GetResourceData`. -+/// -+#[derive(::std::clone::Clone)] -+pub struct GetResourceDataFluentBuilder { -+ client: crate::types::simple_resource::SimpleResourceRef, -+ inner: crate::operation::get_resource_data::builders::GetResourceDataInputBuilder, -+} -+impl GetResourceDataFluentBuilder { -+ /// Creates a new `GetResourceData`. -+ #[allow(dead_code)] -+ pub(crate) fn new(client: crate::types::simple_resource::SimpleResourceRef) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetResourceData as a reference. -+ pub fn as_input( -+ &self, -+ ) -> &crate::operation::get_resource_data::builders::GetResourceDataInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_resource_data::GetResourceDataOutput, -+ crate::operation::get_resource_data::GetResourceDataError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetResourceData 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_resource_data::GetResourceDataError::unhandled)?; -+ crate::operation::get_resource_data::GetResourceData::send(self.client, input).await -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn blob_value(mut self, input: impl ::std::convert::Into) -> Self { -+ self.inner = self.inner.blob_value(input.into()); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_blob_value(mut self, input: Option) -> Self { -+ self.inner = self.inner.set_blob_value(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_blob_value(&self) -> &Option { -+ self.inner.get_blob_value() -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn boolean_value(mut self, input: impl ::std::convert::Into) -> Self { -+ self.inner = self.inner.boolean_value(input.into()); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_boolean_value(mut self, input: Option) -> Self { -+ self.inner = self.inner.set_boolean_value(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_boolean_value(&self) -> Option { -+ self.inner.get_boolean_value() -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn string_value(mut self, input: impl ::std::convert::Into) -> Self { -+ self.inner = self.inner.string_value(input.into()); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_string_value(mut self, input: Option) -> Self { -+ self.inner = self.inner.set_string_value(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_string_value(&self) -> &Option { -+ self.inner.get_string_value() -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn integer_value(mut self, input: impl ::std::convert::Into) -> Self { -+ self.inner = self.inner.integer_value(input.into()); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_integer_value(mut self, input: Option) -> Self { -+ self.inner = self.inner.set_integer_value(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_integer_value(&self) -> Option { -+ self.inner.get_integer_value() -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn long_value(mut self, input: impl ::std::convert::Into) -> Self { -+ self.inner = self.inner.long_value(input.into()); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_long_value(mut self, input: Option) -> Self { -+ self.inner = self.inner.set_long_value(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_long_value(&self) -> Option { -+ self.inner.get_long_value() -+ } -+} -diff --git b/TestModels/Resource/runtimes/rust/src/operation/get_resources.rs a/TestModels/Resource/runtimes/rust/src/operation/get_resources.rs -new file mode 100644 -index 00000000..56fc89a4 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/operation/get_resources.rs -@@ -0,0 +1,145 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetResources`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetResources; -+impl GetResources { -+ /// Creates a new `GetResources` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_resources::GetResourcesInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_resources::GetResourcesOutput, -+ crate::operation::get_resources::GetResourcesError, -+ > { -+ let inner_input = crate::conversions::get_resources::_get_resources_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetResources(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_resources::_get_resources_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_resources::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetResources` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetResourcesError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetResourcesError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetResourcesError { -+ /// Creates the `GetResourcesError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetResourcesError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetResourcesError { -+ 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 GetResourcesError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetResourcesError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetResourcesError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetResourcesError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_resources::_get_resources_output::GetResourcesOutput; -+ -+pub use crate::operation::get_resources::_get_resources_input::GetResourcesInput; -+ -+mod _get_resources_input; -+ -+mod _get_resources_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/Resource/runtimes/rust/src/operation/get_resources/_get_resources_input.rs a/TestModels/Resource/runtimes/rust/src/operation/get_resources/_get_resources_input.rs -new file mode 100644 -index 00000000..33115a6a ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/operation/get_resources/_get_resources_input.rs -@@ -0,0 +1,56 @@ -+// 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 GetResourcesInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub(crate) value: ::std::option::Option<::std::string::String>, -+} -+impl GetResourcesInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> &::std::option::Option { -+ &self.value -+ } -+} -+impl GetResourcesInput { -+ /// Creates a new builder-style object to manufacture [`GetResourcesInput`](crate::operation::operation::GetResourcesInput). -+ pub fn builder() -> crate::operation::get_resources::builders::GetResourcesInputBuilder { -+ crate::operation::get_resources::builders::GetResourcesInputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetResourcesInput`](crate::operation::operation::GetResourcesInput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetResourcesInputBuilder { -+ pub(crate) value: ::std::option::Option<::std::string::String>, -+} -+impl GetResourcesInputBuilder { -+ #[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 [`GetResourcesInput`](crate::operation::operation::GetResourcesInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_resources::GetResourcesInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_resources::GetResourcesInput { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/Resource/runtimes/rust/src/operation/get_resources/_get_resources_output.rs a/TestModels/Resource/runtimes/rust/src/operation/get_resources/_get_resources_output.rs -new file mode 100644 -index 00000000..a5956b44 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/operation/get_resources/_get_resources_output.rs -@@ -0,0 +1,63 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(missing_docs)] // documentation missing in model -+#[non_exhaustive] -+pub struct GetResourcesOutput { -+ pub(crate) output: crate::types::simple_resource::SimpleResourceRef, -+} -+ -+impl GetResourcesOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn output(&self) -> crate::types::simple_resource::SimpleResourceRef { -+ self.output.clone() -+ } -+} -+ -+impl GetResourcesOutput { -+ /// Creates a new builder-style object to manufacture [`GetResourcesOutput`](crate::operation::operation::GetResourcesOutput). -+ pub fn builder() -> crate::operation::get_resources::builders::GetResourcesOutputBuilder { -+ crate::operation::get_resources::builders::GetResourcesOutputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetResourcesOutput`](crate::operation::operation::GetResourcesOutput). -+#[non_exhaustive] -+#[derive(::std::clone::Clone, ::std::default::Default)] -+pub struct GetResourcesOutputBuilder { -+ pub(crate) output: ::std::option::Option, -+} -+ -+impl GetResourcesOutputBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn output(mut self, input: crate::types::simple_resource::SimpleResourceRef) -> Self { -+ self.output = ::std::option::Option::Some(input); -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn set_output( -+ mut self, -+ input: ::std::option::Option, -+ ) -> Self { -+ self.output = input; -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_output( -+ &self, -+ ) -> &::std::option::Option { -+ &self.output -+ } -+ -+ /// Consumes the builder and constructs a [`GetResourcesOutput`](crate::operation::operation::GetResourcesOutput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_resources::GetResourcesOutput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_resources::GetResourcesOutput { -+ output: self.output.unwrap(), -+ }) -+ } -+} -diff --git b/TestModels/Resource/runtimes/rust/src/operation/get_resources/builders.rs a/TestModels/Resource/runtimes/rust/src/operation/get_resources/builders.rs -new file mode 100644 -index 00000000..56453a6b ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/operation/get_resources/builders.rs -@@ -0,0 +1,72 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_resources::_get_resources_output::GetResourcesOutputBuilder; -+ -+pub use crate::operation::get_resources::_get_resources_input::GetResourcesInputBuilder; -+ -+impl GetResourcesInputBuilder { -+ /// 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_resources::GetResourcesOutput, -+ crate::operation::get_resources::GetResourcesError, -+ > { -+ let mut fluent_builder = client.get_resources(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetResources`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetResourcesFluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::get_resources::builders::GetResourcesInputBuilder, -+} -+impl GetResourcesFluentBuilder { -+ /// Creates a new `GetResources`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetResources as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_resources::builders::GetResourcesInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_resources::GetResourcesOutput, -+ crate::operation::get_resources::GetResourcesError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetResources 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_resources::GetResourcesError::unhandled)?; -+ crate::operation::get_resources::GetResources::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() -+ } -+} -diff --git b/TestModels/Resource/runtimes/rust/src/standard_library_conversions.rs a/TestModels/Resource/runtimes/rust/src/standard_library_conversions.rs -new file mode 100644 -index 00000000..2fec0ffb ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/standard_library_conversions.rs -@@ -0,0 +1,246 @@ -+pub fn ostring_to_dafny( -+ input: &Option, -+) -> ::std::rc::Rc< -+ 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 {}, -+}; -+ ::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>>, -+ >, -+) -> 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 -+ } -+} -+ -+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 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) -+} -+ -+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 -+ } -+} -+ -+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 blob_to_dafny( -+ input: &::aws_smithy_types::Blob, -+) -> ::dafny_runtime::Sequence { -+ ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) -+} -+ -+pub fn oblob_to_dafny( -+ 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) -+} -+ -+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>>, -+) -> Option<::aws_smithy_types::Blob> { -+ 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 odouble_to_dafny( -+ 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) -+} -+ -+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>>, -+) -> Option { -+ 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, -+) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { -+ ::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) -+} -+ -+pub fn timestamp_from_dafny( -+ 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() -+} -+ -+pub fn otimestamp_from_dafny( -+ input: ::std::rc::Rc>>, -+) -> Option<::aws_smithy_types::DateTime> { -+ 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, -+) -> Option { -+ 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, -+) -> ::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 {} -+ ), -+ } -+} -+ -+pub fn result_from_dafny( -+ 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)), -+ } -+} -+ -+pub fn result_to_dafny( -+ 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 -diff --git b/TestModels/Resource/runtimes/rust/src/types.rs a/TestModels/Resource/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..3ce75ec7 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/types.rs -@@ -0,0 +1,8 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `SimpleResource` -+pub mod simple_resource; -+pub use simple_resource::SimpleResource; -+ -+/// Types for the `SimpleResourcesConfig` -+pub mod simple_resources_config; -diff --git b/TestModels/Resource/runtimes/rust/src/types/simple_resource.rs a/TestModels/Resource/runtimes/rust/src/types/simple_resource.rs -new file mode 100644 -index 00000000..dcc17819 ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/types/simple_resource.rs -@@ -0,0 +1,13 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub trait SimpleResource { -+ fn get_resource_data( -+ &mut self, -+ input: crate::operation::get_resource_data::GetResourceDataInput, -+ ) -> Result< -+ crate::operation::get_resource_data::GetResourceDataOutput, -+ crate::operation::get_resource_data::GetResourceDataError, -+ >; -+} -+ -+pub type SimpleResourceRef = ::std::rc::Rc>; -diff --git b/TestModels/Resource/runtimes/rust/src/types/simple_resources_config.rs a/TestModels/Resource/runtimes/rust/src/types/simple_resources_config.rs -new file mode 100644 -index 00000000..1001602b ---- /dev/null -+++ a/TestModels/Resource/runtimes/rust/src/types/simple_resources_config.rs -@@ -0,0 +1,61 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleResourcesConfig { -+ pub(crate) name: String, -+} -+ -+impl SimpleResourcesConfig { -+ pub fn builder() -> SimpleResourcesConfigBuilder { -+ SimpleResourcesConfigBuilder::new() -+ } -+ pub fn name(&self) -> &String { -+ &self.name -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug, ::std::default::Default)] -+pub struct SimpleResourcesConfigBuilder { -+ name: Option, -+} -+ -+impl SimpleResourcesConfigBuilder { -+ /// Creates a new `SimpleResourcesConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self::default() -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ SimpleResourcesConfig, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ if self.name.is_none() { -+ Err( -+ aws_smithy_types::error::operation::BuildError::missing_field( -+ "name", -+ "Required for SimpleResourcesConfig.", -+ ), -+ ) -+ } else if self.name.as_ref().unwrap().len() < 1 { -+ Err( -+ aws_smithy_types::error::operation::BuildError::invalid_field( -+ "name", -+ "Length must be at least 1.", -+ ), -+ ) -+ } else { -+ ::std::result::Result::Ok(SimpleResourcesConfig { -+ name: self.name.unwrap(), -+ }) -+ } -+ } -+ pub fn name(mut self, input: impl ::std::convert::Into) -> Self { -+ self.name = ::std::option::Option::Some(input.into()); -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_name(&self) -> &::std::option::Option { -+ &self.name -+ } -+} diff --git a/TestModels/Resource/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/Resource/runtimes/rust/src/implementation_from_dafny.rs index d698ebfd5..aa70dccc0 100644 --- a/TestModels/Resource/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/Resource/runtimes/rust/src/implementation_from_dafny.rs @@ -13,10 +13,12 @@ pub mod operation; mod conversions; mod standard_library_conversions; +#[cfg(feature = "wrapped-client")] +pub mod wrapped; + pub use client::Client; pub use types::simple_resources_config::SimpleResourcesConfig; - pub mod r#_Wrappers_Compile { pub use dafny_runtime::DafnyPrint; pub use std::cmp::Eq; @@ -1396,13 +1398,13 @@ pub mod simple { >, >::new(); let mut internalConfig: ::std::rc::Rc< - crate::r#simpleResourcesOperations_Compile::Config, + crate::r#_SimpleResourcesOperations_Compile::Config, > = ::std::rc::Rc::new( - crate::r#simpleResourcesOperations_Compile::Config::Config { + crate::r#_SimpleResourcesOperations_Compile::Config::Config { name: config.name().clone(), }, ); - if crate::r#simpleResourcesOperations_Compile::_default::r#_ValidInternalConfig_q(&internalConfig) { + if crate::r#_SimpleResourcesOperations_Compile::_default::r#_ValidInternalConfig_q(&internalConfig) { let mut client = ::dafny_runtime::MaybePlacebo::<::dafny_runtime::Object>::new(); let mut _nw2: ::dafny_runtime::Object = crate::simple::resources::internaldafny::SimpleResourcesClient::_allocate_object(); crate::simple::resources::internaldafny::SimpleResourcesClient::_ctor(&_nw2, &internalConfig); @@ -1435,7 +1437,7 @@ pub mod simple { pub struct SimpleResourcesClient { pub r#__i_config: - ::std::rc::Rc, + ::std::rc::Rc, } impl SimpleResourcesClient { @@ -1446,7 +1448,7 @@ pub mod simple { this: &::dafny_runtime::Object< crate::simple::resources::internaldafny::SimpleResourcesClient, >, - config: &::std::rc::Rc, + config: &::std::rc::Rc, ) -> () { let mut _set__i_config: bool = false; ::dafny_runtime::update_field_uninit_object!( @@ -1459,7 +1461,7 @@ pub mod simple { } pub fn config( &self, - ) -> ::std::rc::Rc + ) -> ::std::rc::Rc { self.r#__i_config.clone() } @@ -1486,7 +1488,7 @@ pub mod simple { 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#simpleResourcesOperations_Compile::_default::GetResources( + crate::r#_SimpleResourcesOperations_Compile::_default::GetResources( &self.config().clone(), input, ), @@ -2374,7 +2376,7 @@ pub mod simple { } } } -pub mod r#simpleResource_Compile { +pub mod r#_SimpleResource_Compile { pub use crate::simple::resources::internaldafny::types::ISimpleResource; pub use dafny_runtime::UpcastObject; pub use std::any::Any; @@ -2393,7 +2395,7 @@ pub mod r#simpleResource_Compile { ::dafny_runtime::allocate_object::() } pub fn _ctor( - this: &::dafny_runtime::Object, + this: &::dafny_runtime::Object, value: &::std::rc::Rc< crate::r#_Wrappers_Compile::Option< ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, @@ -2497,7 +2499,7 @@ pub mod r#simpleResource_Compile { ::dafny_runtime::UpcastObjectFn!(dyn crate::simple::resources::internaldafny::types::ISimpleResource); } } -pub mod r#simpleResourcesOperations_Compile { +pub mod r#_SimpleResourcesOperations_Compile { pub use dafny_runtime::DafnyPrint; pub use std::cmp::Eq; pub use std::convert::AsRef; @@ -2509,12 +2511,12 @@ pub mod r#simpleResourcesOperations_Compile { impl _default { pub fn r#_ValidInternalConfig_q( - config: &::std::rc::Rc, + config: &::std::rc::Rc, ) -> bool { true && ::dafny_runtime::int!(0) < config.name().cardinality() } pub fn GetResources( - config: &::std::rc::Rc, + config: &::std::rc::Rc, input: &::std::rc::Rc< crate::simple::resources::internaldafny::types::GetResourcesInput, >, @@ -2535,19 +2537,19 @@ pub mod r#simpleResourcesOperations_Compile { >, >::new(); let mut resource = ::dafny_runtime::MaybePlacebo::< - ::dafny_runtime::Object, + ::dafny_runtime::Object, >::new(); let mut _nw1: ::dafny_runtime::Object< - crate::r#simpleResource_Compile::SimpleResource, - > = crate::r#simpleResource_Compile::SimpleResource::_allocate_object(); - crate::r#simpleResource_Compile::SimpleResource::_ctor( + crate::r#_SimpleResource_Compile::SimpleResource, + > = crate::r#_SimpleResource_Compile::SimpleResource::_allocate_object(); + crate::r#_SimpleResource_Compile::SimpleResource::_ctor( &_nw1, input.value(), config.name(), ); resource = ::dafny_runtime::MaybePlacebo::from(_nw1.clone()); let mut result: ::std::rc::Rc = ::std::rc::Rc::new(crate::simple::resources::internaldafny::types::GetResourcesOutput::GetResourcesOutput { - output: ::dafny_runtime::upcast_object::()(resource.read()) + output: ::dafny_runtime::upcast_object::()(resource.read()) }); output = ::dafny_runtime::MaybePlacebo::from(::std::rc::Rc::new( crate::r#_Wrappers_Compile::Result::< diff --git a/TestModels/SharedMakefile.mk b/TestModels/SharedMakefile.mk index 975ba217a..28261b851 100644 --- a/TestModels/SharedMakefile.mk +++ b/TestModels/SharedMakefile.mk @@ -31,7 +31,7 @@ _polymorph_code_gen: OUTPUT_DOTNET_WRAPPED=\ _polymorph_code_gen: _polymorph_wrapped # Override this to make polymorph_dafny on the standard library, -# which generated the project.properties file. +# which generates the project.properties file. polymorph_dafny: POLYMORPH_LANGUAGE_TARGET=dafny polymorph_dafny: _polymorph_dependencies polymorph_dafny: @@ -73,7 +73,10 @@ _polymorph_dotnet: _polymorph_wrapped _polymorph_rust: OUTPUT_RUST=--output-rust $(LIBRARY_ROOT)/runtimes/rust _polymorph_rust: INPUT_DAFNY=\ --include-dafny $(PROJECT_ROOT)/$(STD_LIBRARY)/src/Index.dfy -_polymorph_rust: _polymorph +# For several TestModels we've just manually written the code generation target, +# So we just want to ensure we can transpile and pass the tests in CI. +# For those, make polymorph_rust should just be a no-op. +_polymorph_rust: $(if $(RUST_BENERATED), , _polymorph) # TODO: This doesn't yet work for Rust because we are patching transpiled code, # so this target will complain about "patch does not apply" because it was already applied. # _polymorph_rust: OUTPUT_RUST_WRAPPED=--output-rust $(LIBRARY_ROOT)/runtimes/rust diff --git a/TestModels/SimpleTypes/SimpleBlob/Makefile b/TestModels/SimpleTypes/SimpleBlob/Makefile index d48c80281..0bc8fadca 100644 --- a/TestModels/SimpleTypes/SimpleBlob/Makefile +++ b/TestModels/SimpleTypes/SimpleBlob/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../../SharedMakefile.mk NAMESPACE=simple.types.blob diff --git a/TestModels/SimpleTypes/SimpleBlob/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/SimpleTypes/SimpleBlob/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index fef50d1f5..000000000 --- a/TestModels/SimpleTypes/SimpleBlob/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,1569 +0,0 @@ -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..0e7fbefe ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client.rs -@@ -0,0 +1,38 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ 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), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+mod get_blob; -+ -+mod get_blob_known_value; -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob.rs -new file mode 100644 -index 00000000..c09128d4 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob.rs -@@ -0,0 +1,13 @@ -+// 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::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)
-+ /// - On success, responds with [`GetBlobOutput`](crate::operation::get_blob::GetBlobOutput) with field(s): -+ /// - [`value(Option)`](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 b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob_known_value.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob_known_value.rs -new file mode 100644 -index 00000000..a8831d24 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/client/get_blob_known_value.rs -@@ -0,0 +1,17 @@ -+// 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 b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..1cd4ad22 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions.rs -@@ -0,0 +1,6 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_blob; -+ -+pub mod get_blob_known_value; -+ -+pub mod simple_blob_config; -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob.rs -new file mode 100644 -index 00000000..43479fd3 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob.rs -@@ -0,0 +1,37 @@ -+// 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::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), -+ ), -+ }, -+ ), -+ } -+} -+ -+#[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::GetBlobError { -+ // 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::GetBlobError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_blob::GetBlobError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_blob_input; -+ -+pub mod _get_blob_output; -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_input.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_input.rs -new file mode 100644 -index 00000000..5c7d9c2b ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_input.rs -@@ -0,0 +1,42 @@ -+// 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::GetBlobInput, -+) -> ::std::rc::Rc -+{ -+ let dafny_value = match value.value { -+ Some(v) => crate::_Wrappers_Compile::Option::Some { -+ value: ::dafny_runtime::Sequence::from_array(&v), -+ }, -+ 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::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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_output.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_output.rs -new file mode 100644 -index 00000000..e9770da2 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob/_get_blob_output.rs -@@ -0,0 +1,43 @@ -+// 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::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::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::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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value.rs -new file mode 100644 -index 00000000..50a67357 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value.rs -@@ -0,0 +1,39 @@ -+// 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 b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_input.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_input.rs -new file mode 100644 -index 00000000..581adeb7 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_input.rs -@@ -0,0 +1,41 @@ -+// 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::Sequence::from_array(&v), -+ }, -+ 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 b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_output.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_output.rs -new file mode 100644 -index 00000000..19cf6355 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/get_blob_known_value/_get_blob_known_value_output.rs -@@ -0,0 +1,43 @@ -+// 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 b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config.rs -new file mode 100644 -index 00000000..89599c3f ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_blob_config; -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config/_simple_blob_config.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config/_simple_blob_config.rs -new file mode 100644 -index 00000000..d0a4cd5c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/conversions/simple_blob_config/_simple_blob_config.rs -@@ -0,0 +1,18 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::types::simple_blob_config::SimpleBlobConfig, -+) -> ::std::rc::Rc -+{ -+ ::std::rc::Rc::new(crate::r#simple::types::blob::internaldafny::types::SimpleBlobConfig::SimpleBlobConfig {}) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::blob::internaldafny::types::SimpleBlobConfig, -+ >, -+) -> crate::types::simple_blob_config::SimpleBlobConfig { -+ crate::types::simple_blob_config::SimpleBlobConfig {} -+} -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/implementation_from_dafny.rs -index ef528d59..1c1963a2 100644 ---- b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,22 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+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; -+mod standard_library_conversions; -+ -+pub use client::Client; -+pub use types::simple_blob_config::SimpleBlobConfig; -+ -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/lib.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..3938142e ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/lib.rs -@@ -0,0 +1,19 @@ -+#![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 b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..a72267ed ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation.rs -@@ -0,0 +1,7 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetBlob` operation. -+pub mod get_blob; -+ -+/// Types for the `GetBlobKnownValue` operation. -+pub mod get_blob_known_value; -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob.rs -new file mode 100644 -index 00000000..2c923f1a ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob.rs -@@ -0,0 +1,142 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetBlob`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetBlob; -+impl GetBlob { -+ /// Creates a new `GetBlob` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_blob::GetBlobInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_blob::GetBlobOutput, -+ 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); -+ 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(), -+ )) -+ } else { -+ Err(crate::conversions::get_blob::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetBlob` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetBlobError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetBlobError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetBlobError { -+ /// Creates the `GetBlobError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetBlobError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetBlobError { -+ 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 GetBlobError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetBlobError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetBlobError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetBlobError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_blob::_get_blob_output::GetBlobOutput; -+ -+pub use crate::operation::get_blob::_get_blob_input::GetBlobInput; -+ -+mod _get_blob_input; -+ -+mod _get_blob_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_input.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_input.rs -new file mode 100644 -index 00000000..6a0d554b ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_input.rs -@@ -0,0 +1,60 @@ -+// 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 GetBlobInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, -+} -+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() -+ } -+} -+impl GetBlobInput { -+ /// Creates a new builder-style object to manufacture [`GetBlobInput`](crate::operation::operation::GetBlobInput). -+ pub fn builder() -> crate::operation::get_blob::builders::GetBlobInputBuilder { -+ crate::operation::get_blob::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<::std::vec::Vec<::std::primitive::u8>>, -+} -+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() -+ } -+ /// Consumes the builder and constructs a [`GetBlobInput`](crate::operation::operation::GetBlobInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_blob::GetBlobInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_blob::GetBlobInput { value: self.value }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_output.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_output.rs -new file mode 100644 -index 00000000..b071eb83 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/_get_blob_output.rs -@@ -0,0 +1,66 @@ -+// 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 GetBlobOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>, -+} -+ -+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() -+ } -+} -+ -+impl GetBlobOutput { -+ /// Creates a new builder-style object to manufacture [`GetBlobOutput`](crate::operation::operation::GetBlobOutput). -+ pub fn builder() -> crate::operation::get_blob::builders::GetBlobOutputBuilder { -+ crate::operation::get_blob::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<::std::vec::Vec<::std::primitive::u8>>, -+} -+ -+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() -+ } -+ -+ /// Consumes the builder and constructs a [`GetBlobOutput`](crate::operation::operation::GetBlobOutput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_blob::GetBlobOutput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_blob::GetBlobOutput { value: self.value }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/builders.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/builders.rs -new file mode 100644 -index 00000000..bedb57b1 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob/builders.rs -@@ -0,0 +1,78 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_blob::_get_blob_output::GetBlobOutputBuilder; -+ -+pub use crate::operation::get_blob::_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::GetBlobOutput, -+ crate::operation::get_blob::GetBlobError, -+ > { -+ let mut fluent_builder = client.get_blob(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetBlob`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetBlobFluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::get_blob::builders::GetBlobInputBuilder, -+} -+impl GetBlobFluentBuilder { -+ /// Creates a new `GetBlob`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetBlob as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_blob::builders::GetBlobInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_blob::GetBlobOutput, -+ crate::operation::get_blob::GetBlobError, -+ > { -+ 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::GetBlobError::unhandled)?; -+ crate::operation::get_blob::GetBlob::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 b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value.rs -new file mode 100644 -index 00000000..ee1819d4 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value.rs -@@ -0,0 +1,145 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetBlobKnownValue`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetBlobKnownValue; -+impl GetBlobKnownValue { -+ /// Creates a new `GetBlobKnownValue` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_blob_known_value::GetBlobKnownValueInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_blob_known_value::GetBlobKnownValueOutput, -+ crate::operation::get_blob_known_value::GetBlobKnownValueError, -+ > { -+ 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); -+ 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( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_blob_known_value::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetBlobKnownValue` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetBlobKnownValueError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetBlobKnownValueError) 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. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetBlobKnownValueError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetBlobKnownValueError { -+ 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 { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetBlobKnownValueError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetBlobKnownValueError { -+ 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 { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_blob_known_value::_get_blob_known_value_output::GetBlobKnownValueOutput; -+ -+pub use crate::operation::get_blob_known_value::_get_blob_known_value_input::GetBlobKnownValueInput; -+ -+mod _get_blob_known_value_input; -+ -+mod _get_blob_known_value_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_input.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_input.rs -new file mode 100644 -index 00000000..be28c19c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_input.rs -@@ -0,0 +1,63 @@ -+// 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 b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_output.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_output.rs -new file mode 100644 -index 00000000..794b83ce ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/_get_blob_known_value_output.rs -@@ -0,0 +1,63 @@ -+// 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 b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/builders.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/builders.rs -new file mode 100644 -index 00000000..274bb3f3 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/operation/get_blob_known_value/builders.rs -@@ -0,0 +1,80 @@ -+// 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 b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/standard_library_conversions.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/standard_library_conversions.rs -new file mode 100644 -index 00000000..2fec0ffb ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/standard_library_conversions.rs -@@ -0,0 +1,246 @@ -+pub fn ostring_to_dafny( -+ input: &Option, -+) -> ::std::rc::Rc< -+ 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 {}, -+}; -+ ::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>>, -+ >, -+) -> 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 -+ } -+} -+ -+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 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) -+} -+ -+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 -+ } -+} -+ -+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 blob_to_dafny( -+ input: &::aws_smithy_types::Blob, -+) -> ::dafny_runtime::Sequence { -+ ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) -+} -+ -+pub fn oblob_to_dafny( -+ 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) -+} -+ -+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>>, -+) -> Option<::aws_smithy_types::Blob> { -+ 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 odouble_to_dafny( -+ 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) -+} -+ -+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>>, -+) -> Option { -+ 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, -+) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { -+ ::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) -+} -+ -+pub fn timestamp_from_dafny( -+ 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() -+} -+ -+pub fn otimestamp_from_dafny( -+ input: ::std::rc::Rc>>, -+) -> Option<::aws_smithy_types::DateTime> { -+ 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, -+) -> Option { -+ 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, -+) -> ::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 {} -+ ), -+ } -+} -+ -+pub fn result_from_dafny( -+ 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)), -+ } -+} -+ -+pub fn result_to_dafny( -+ 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 -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..1dca219a ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `SimpleBlobConfig` -+pub mod simple_blob_config; -diff --git b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types/simple_blob_config.rs a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types/simple_blob_config.rs -new file mode 100644 -index 00000000..0709ccb7 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/types/simple_blob_config.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleBlobConfig {} -+ -+impl SimpleBlobConfig { -+ pub fn builder() -> SimpleBlobConfigBuilder { -+ SimpleBlobConfigBuilder::new() -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleBlobConfigBuilder {} -+ -+impl SimpleBlobConfigBuilder { -+ /// Creates a new `SimpleBlobConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self {} -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result -+ { -+ ::std::result::Result::Ok(SimpleBlobConfig {}) -+ } -+} diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/implementation_from_dafny.rs index 1c1963a20..72c3073bf 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/rust/src/implementation_from_dafny.rs @@ -13,10 +13,12 @@ pub mod operation; mod conversions; mod standard_library_conversions; +#[cfg(feature = "wrapped-client")] +pub mod wrapped; + pub use client::Client; pub use types::simple_blob_config::SimpleBlobConfig; - pub mod r#_Wrappers_Compile { pub use dafny_runtime::DafnyPrint; pub use std::cmp::Eq; diff --git a/TestModels/SimpleTypes/SimpleBoolean/Makefile b/TestModels/SimpleTypes/SimpleBoolean/Makefile index a0007469f..c0fbc380c 100644 --- a/TestModels/SimpleTypes/SimpleBoolean/Makefile +++ b/TestModels/SimpleTypes/SimpleBoolean/Makefile @@ -8,6 +8,8 @@ CORES=2 TRANSPILE_TESTS_IN_RUST=1 +RUST_BENERATED=1 + include ../../SharedMakefile.mk NAMESPACE=simple.types.boolean diff --git a/TestModels/SimpleTypes/SimpleBoolean/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/SimpleTypes/SimpleBoolean/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index 63c8138c7..000000000 --- a/TestModels/SimpleTypes/SimpleBoolean/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,1010 +0,0 @@ -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/client.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..7c61a140 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/client.rs -@@ -0,0 +1,37 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ pub fn from_conf( -+ conf: crate::types::simple_boolean_config::SimpleBooleanConfig, -+ ) -> Result { -+ let inner = -+ crate::simple::types::boolean::internaldafny::_default::SimpleBoolean( -+ &crate::conversions::simple_boolean_config::_simple_boolean_config::to_dafny(conf), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) -+ }) -+ } -+} -+ -+mod get_boolean; -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/client/get_boolean.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/client/get_boolean.rs -new file mode 100644 -index 00000000..299b0baa ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/client/get_boolean.rs -@@ -0,0 +1,13 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetBoolean`](crate::operation::get_boolean::builders::GetBooleanFluentBuilder) operation. -+ /// -+ /// - The fluent builder is configurable: -+ /// - [`value(impl Into>)`](crate::operation::get_boolean::builders::GetBooleanFluentBuilder::name) / [`set_name(Option)`](crate::operation::get_boolean::builders::GetBooleanFluentBuilder::set_name):(undocumented)
-+ /// - On success, responds with [`GetBooleanOutput`](crate::operation::get_boolean::GetBooleanOutput) with field(s): -+ /// - [`value(Option)`](crate::operation::get_boolean::GetBooleanOutput::value): (undocumented) -+ /// - On failure, responds with [`SdkError`](crate::operation::get_boolean::GetBooleanError) -+ pub fn get_boolean(&self) -> crate::operation::get_boolean::builders::GetBooleanFluentBuilder { -+ crate::operation::get_boolean::builders::GetBooleanFluentBuilder::new(self.clone()) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..86f87891 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions.rs -@@ -0,0 +1,6 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_boolean; -+ -+pub mod simple_boolean_config; -+ -+pub(crate) mod error; -\ No newline at end of file -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/error.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/error.rs -new file mode 100644 -index 00000000..6e7334d5 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/error.rs -@@ -0,0 +1,30 @@ -+/// 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::boolean::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) -+ } -+ ) -+} -\ No newline at end of file -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/get_boolean.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/get_boolean.rs -new file mode 100644 -index 00000000..55d5124b ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/get_boolean.rs -@@ -0,0 +1,32 @@ -+// 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_boolean::GetBooleanError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_boolean::GetBooleanError::Unhandled(unhandled) => -+ ::std::rc::Rc::new(crate::r#simple::types::boolean::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::boolean::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_boolean::GetBooleanError { -+ // 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::boolean::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_boolean::GetBooleanError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_boolean::GetBooleanError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_boolean_input; -+ -+pub mod _get_boolean_output; -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/get_boolean/_get_boolean_input.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/get_boolean/_get_boolean_input.rs -new file mode 100644 -index 00000000..c00eb911 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/get_boolean/_get_boolean_input.rs -@@ -0,0 +1,37 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_boolean::GetBooleanInput, -+) -> ::std::rc::Rc< -+ crate::r#simple::types::boolean::internaldafny::types::GetBooleanInput, -+> { -+ 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::boolean::internaldafny::types::GetBooleanInput::GetBooleanInput { -+ value: ::std::rc::Rc::new(dafny_value) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::boolean::internaldafny::types::GetBooleanInput, -+ >, -+) -> crate::operation::get_boolean::GetBooleanInput { -+ 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_boolean::GetBooleanInput { value } -+} -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/get_boolean/_get_boolean_output.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/get_boolean/_get_boolean_output.rs -new file mode 100644 -index 00000000..4014e019 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/get_boolean/_get_boolean_output.rs -@@ -0,0 +1,37 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_boolean::GetBooleanOutput, -+) -> ::std::rc::Rc< -+ crate::r#simple::types::boolean::internaldafny::types::GetBooleanOutput, -+> { -+ 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::boolean::internaldafny::types::GetBooleanOutput::GetBooleanOutput { -+ value: ::std::rc::Rc::new(dafny_value) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::boolean::internaldafny::types::GetBooleanOutput, -+ >, -+) -> crate::operation::get_boolean::GetBooleanOutput { -+ 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_boolean::GetBooleanOutput { value } -+} -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/simple_boolean_config.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/simple_boolean_config.rs -new file mode 100644 -index 00000000..371a47e5 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/simple_boolean_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_boolean_config; -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/simple_boolean_config/_simple_boolean_config.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/simple_boolean_config/_simple_boolean_config.rs -new file mode 100644 -index 00000000..9c55fca9 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/conversions/simple_boolean_config/_simple_boolean_config.rs -@@ -0,0 +1,19 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::types::simple_boolean_config::SimpleBooleanConfig, -+) -> ::std::rc::Rc< -+ crate::simple::types::boolean::internaldafny::types::SimpleBooleanConfig, -+> { -+ ::std::rc::Rc::new(crate::r#simple::types::boolean::internaldafny::types::SimpleBooleanConfig::SimpleBooleanConfig {}) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::boolean::internaldafny::types::SimpleBooleanConfig, -+ >, -+) -> crate::types::simple_boolean_config::SimpleBooleanConfig { -+ crate::types::simple_boolean_config::SimpleBooleanConfig {} -+} -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/error.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..4d66eb2e ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,30 @@ -+use std::any::Any; -+ -+use dafny_runtime::UpcastObject; -+ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -\ No newline at end of file -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/implementation_from_dafny.rs -index 0237283a..162bb766 100644 ---- b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,23 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+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; -+ -+#[cfg(feature = "wrapped-client")] -+pub mod wrapped; -+ -+pub use client::Client; -+pub use types::simple_boolean_config::SimpleBooleanConfig; -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -@@ -2035,6 +2052,52 @@ pub mod r#_SimpleBooleanImpl_Compile { - } - } - } -+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< -+ crate::r#_Wrappers_Compile::Option< -+ ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, -+ >, -+ > { -+ ::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< -+ crate::r#_Wrappers_Compile::Option< -+ ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, -+ >, -+ > { -+ ::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 r#_SimpleBooleanImplTest_Compile { - pub struct _default {} - -@@ -2277,52 +2340,6 @@ pub mod r#_WrappedSimpleTypesBooleanTest_Compile { - _default::GetBooleanFalse() - } - } --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< -- crate::r#_Wrappers_Compile::Option< -- ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, -- >, -- > { -- ::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< -- crate::r#_Wrappers_Compile::Option< -- ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, -- >, -- > { -- ::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 _module { - pub struct _default {} - -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/lib.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..53977d7d ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/lib.rs -@@ -0,0 +1,20 @@ -+#![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; -+ -+#[cfg(feature = "wrapped-client")] -+pub mod wrapped; -+ -+pub use client::Client; -+pub use types::simple_boolean_config::SimpleBooleanConfig; -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..eb38b9f1 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetBoolean` operation. -+pub mod get_boolean; -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation/get_boolean.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation/get_boolean.rs -new file mode 100644 -index 00000000..362a3cde ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation/get_boolean.rs -@@ -0,0 +1,145 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetBoolean`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetBoolean; -+impl GetBoolean { -+ /// Creates a new `GetBoolean` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_boolean::GetBooleanInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_boolean::GetBooleanOutput, -+ crate::operation::get_boolean::GetBooleanError, -+ > { -+ let inner_input = crate::conversions::get_boolean::_get_boolean_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetBoolean(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_boolean::_get_boolean_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_boolean::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetBoolean` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetBooleanError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetBooleanError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetBooleanError { -+ /// Creates the `GetBooleanError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetBooleanError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetBooleanError { -+ 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 GetBooleanError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetBooleanError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetBooleanError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetBooleanError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_boolean::_get_boolean_output::GetBooleanOutput; -+ -+pub use crate::operation::get_boolean::_get_boolean_input::GetBooleanInput; -+ -+mod _get_boolean_input; -+ -+mod _get_boolean_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation/get_boolean/_get_boolean_input.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation/get_boolean/_get_boolean_input.rs -new file mode 100644 -index 00000000..d669cf35 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation/get_boolean/_get_boolean_input.rs -@@ -0,0 +1,56 @@ -+// 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 GetBooleanInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option<::std::primitive::bool>, -+} -+impl GetBooleanInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option { -+ self.value -+ } -+} -+impl GetBooleanInput { -+ /// Creates a new builder-style object to manufacture [`GetBooleanInput`](crate::operation::operation::GetBooleanInput). -+ pub fn builder() -> crate::operation::get_boolean::builders::GetBooleanInputBuilder { -+ crate::operation::get_boolean::builders::GetBooleanInputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetBooleanInput`](crate::operation::operation::GetBooleanInput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetBooleanInputBuilder { -+ pub(crate) value: ::std::option::Option<::std::primitive::bool>, -+} -+impl GetBooleanInputBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::bool>) -> 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::bool>) -> Self { -+ self.value = input; -+ self -+ } -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_value(&self) -> &::std::option::Option<::std::primitive::bool> { -+ &self.value -+ } -+ /// Consumes the builder and constructs a [`GetBooleanInput`](crate::operation::operation::GetBooleanInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_boolean::GetBooleanInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_boolean::GetBooleanInput { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation/get_boolean/_get_boolean_output.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation/get_boolean/_get_boolean_output.rs -new file mode 100644 -index 00000000..d2943f38 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation/get_boolean/_get_boolean_output.rs -@@ -0,0 +1,62 @@ -+// 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 GetBooleanOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option<::std::primitive::bool>, -+} -+ -+impl GetBooleanOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option { -+ self.value -+ } -+} -+ -+impl GetBooleanOutput { -+ /// Creates a new builder-style object to manufacture [`GetBooleanOutput`](crate::operation::operation::GetBooleanOutput). -+ pub fn builder() -> crate::operation::get_boolean::builders::GetBooleanOutputBuilder { -+ crate::operation::get_boolean::builders::GetBooleanOutputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetBooleanOutput`](crate::operation::operation::GetBooleanOutput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetBooleanOutputBuilder { -+ pub(crate) value: ::std::option::Option<::std::primitive::bool>, -+} -+ -+impl GetBooleanOutputBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::bool>) -> 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::bool>) -> Self { -+ self.value = input; -+ self -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn get_value(&self) -> &::std::option::Option<::std::primitive::bool> { -+ &self.value -+ } -+ -+ /// Consumes the builder and constructs a [`GetBooleanOutput`](crate::operation::operation::GetBooleanOutput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_boolean::GetBooleanOutput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_boolean::GetBooleanOutput { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation/get_boolean/builders.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation/get_boolean/builders.rs -new file mode 100644 -index 00000000..e672a270 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/operation/get_boolean/builders.rs -@@ -0,0 +1,72 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_boolean::_get_boolean_output::GetBooleanOutputBuilder; -+ -+pub use crate::operation::get_boolean::_get_boolean_input::GetBooleanInputBuilder; -+ -+impl GetBooleanInputBuilder { -+ /// 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_boolean::GetBooleanOutput, -+ crate::operation::get_boolean::GetBooleanError, -+ > { -+ let mut fluent_builder = client.get_boolean(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetBoolean`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetBooleanFluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::get_boolean::builders::GetBooleanInputBuilder, -+} -+impl GetBooleanFluentBuilder { -+ /// Creates a new `GetBoolean`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetBoolean as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_boolean::builders::GetBooleanInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_boolean::GetBooleanOutput, -+ crate::operation::get_boolean::GetBooleanError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetBoolean 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_boolean::GetBooleanError::unhandled)?; -+ crate::operation::get_boolean::GetBoolean::send(&self.client, input).await -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(mut self, input: impl ::std::convert::Into<::std::primitive::bool>) -> 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::bool>) -> 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::bool> { -+ self.inner.get_value() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/types.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..e60785dc ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/types.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `SimpleBooleanConfig` -+pub mod simple_boolean_config; -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/types/simple_boolean_config.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/types/simple_boolean_config.rs -new file mode 100644 -index 00000000..6bf027f6 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/types/simple_boolean_config.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleBooleanConfig {} -+ -+impl SimpleBooleanConfig { -+ pub fn builder() -> SimpleBooleanConfigBuilder { -+ SimpleBooleanConfigBuilder::new() -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleBooleanConfigBuilder {} -+ -+impl SimpleBooleanConfigBuilder { -+ /// Creates a new `SimpleBooleanConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self {} -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result -+ { -+ ::std::result::Result::Ok(SimpleBooleanConfig {}) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/wrapped.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/wrapped.rs -new file mode 100644 -index 00000000..10349e12 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/wrapped.rs -@@ -0,0 +1,12 @@ -+pub mod client; -+ -+impl crate::r#simple::types::boolean::internaldafny::wrapped::_default { -+ pub fn WrappedSimpleBoolean(config: &::std::rc::Rc< -+ crate::r#simple::types::boolean::internaldafny::types::SimpleBooleanConfig, -+ >) -> ::std::rc::Rc, -+ ::std::rc::Rc -+ >>{ -+ crate::wrapped::client::Client::from_conf(config) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/wrapped/client.rs a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/wrapped/client.rs -new file mode 100644 -index 00000000..3703ce67 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/wrapped/client.rs -@@ -0,0 +1,88 @@ -+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::boolean::internaldafny::types::ISimpleTypesBooleanClient); -+} -+ -+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::boolean::internaldafny::types::SimpleBooleanConfig, -+ >) -> -+::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_boolean_config::_simple_boolean_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::boolean::internaldafny::types::ISimpleTypesBooleanClient -+ for Client -+{ -+ fn GetBoolean( -+ &mut self, -+ input: &std::rc::Rc< -+ crate::r#simple::types::boolean::internaldafny::types::GetBooleanInput, -+ >, -+ ) -> std::rc::Rc< -+ crate::r#_Wrappers_Compile::Result< -+ std::rc::Rc< -+ crate::r#simple::types::boolean::internaldafny::types::GetBooleanOutput, -+ >, -+ std::rc::Rc, -+ >, -+ >{ -+ let inner_input = -+ crate::conversions::get_boolean::_get_boolean_input::from_dafny(input.clone()); -+ let result = self.rt.block_on(crate::operation::get_boolean::GetBoolean::send(&self.wrapped, inner_input)); -+ match result { -+ Err(error) => ::std::rc::Rc::new( -+ crate::_Wrappers_Compile::Result::Failure { -+ error: crate::conversions::get_boolean::to_dafny_error(error), -+ }, -+ ), -+ Ok(client) => ::std::rc::Rc::new( -+ crate::_Wrappers_Compile::Result::Success { -+ value: crate::conversions::get_boolean::_get_boolean_output::to_dafny(client), -+ }, -+ ), -+ } -+ } -+} diff --git a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/implementation_from_dafny.rs index 162bb766d..23be86f64 100644 --- a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/implementation_from_dafny.rs @@ -11,6 +11,7 @@ pub mod error; pub mod operation; mod conversions; +mod standard_library_conversions; #[cfg(feature = "wrapped-client")] pub mod wrapped; @@ -2052,52 +2053,6 @@ pub mod r#_SimpleBooleanImpl_Compile { } } } -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< - crate::r#_Wrappers_Compile::Option< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - > { - ::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< - crate::r#_Wrappers_Compile::Option< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - > { - ::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 r#_SimpleBooleanImplTest_Compile { pub struct _default {} @@ -2340,6 +2295,52 @@ pub mod r#_WrappedSimpleTypesBooleanTest_Compile { _default::GetBooleanFalse() } } +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< + crate::r#_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + ::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< + crate::r#_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + ::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 _module { pub struct _default {} diff --git a/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/standard_library_conversions.rs new file mode 100644 index 000000000..2fec0ffb5 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleBoolean/runtimes/rust/src/standard_library_conversions.rs @@ -0,0 +1,246 @@ +pub fn ostring_to_dafny( + input: &Option, +) -> ::std::rc::Rc< + 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 {}, +}; + ::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>>, + >, +) -> 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 + } +} + +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 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) +} + +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 + } +} + +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 blob_to_dafny( + input: &::aws_smithy_types::Blob, +) -> ::dafny_runtime::Sequence { + ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) +} + +pub fn oblob_to_dafny( + 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) +} + +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>>, +) -> Option<::aws_smithy_types::Blob> { + 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 odouble_to_dafny( + 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) +} + +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>>, +) -> Option { + 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, +) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { + ::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) +} + +pub fn timestamp_from_dafny( + 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() +} + +pub fn otimestamp_from_dafny( + input: ::std::rc::Rc>>, +) -> Option<::aws_smithy_types::DateTime> { + 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, +) -> Option { + 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, +) -> ::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 {} + ), + } +} + +pub fn result_from_dafny( + 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)), + } +} + +pub fn result_to_dafny( + 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 diff --git a/TestModels/SimpleTypes/SimpleDouble/Makefile b/TestModels/SimpleTypes/SimpleDouble/Makefile index 4b958ce08..407ff8747 100644 --- a/TestModels/SimpleTypes/SimpleDouble/Makefile +++ b/TestModels/SimpleTypes/SimpleDouble/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../../SharedMakefile.mk NAMESPACE=simple.types.smithyDouble diff --git a/TestModels/SimpleTypes/SimpleDouble/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/SimpleTypes/SimpleDouble/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index 8c38d4a74..000000000 --- a/TestModels/SimpleTypes/SimpleDouble/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,1019 +0,0 @@ -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..58270834 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client.rs -@@ -0,0 +1,37 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ pub fn from_conf( -+ conf: crate::types::simple_double_config::SimpleDoubleConfig, -+ ) -> Result { -+ let inner = -+ crate::simple::types::smithydouble::internaldafny::_default::SimpleDouble( -+ &crate::conversions::simple_double_config::_simple_double_config::to_dafny(conf), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+mod get_double; -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client/get_double.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client/get_double.rs -new file mode 100644 -index 00000000..db3ce635 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/client/get_double.rs -@@ -0,0 +1,13 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+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)
-+ /// - On success, responds with [`GetDoubleOutput`](crate::operation::get_double::GetDoubleOutput) with field(s): -+ /// - [`value(Option)`](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 b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..08430ee3 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_double; -+ -+pub mod simple_double_config; -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double.rs -new file mode 100644 -index 00000000..45f3afc1 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double.rs -@@ -0,0 +1,33 @@ -+// 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_double::GetDoubleError, -+) -> ::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)) }) -+ } -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny_error( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::smithydouble::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_double::GetDoubleError { -+ // 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::smithydouble::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_double::GetDoubleError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_double::GetDoubleError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_double_input; -+ -+pub mod _get_double_output; -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_input.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_input.rs -new file mode 100644 -index 00000000..1a6a82f8 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_input.rs -@@ -0,0 +1,47 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_output.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_output.rs -new file mode 100644 -index 00000000..5dcd0eb4 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/get_double/_get_double_output.rs -@@ -0,0 +1,47 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config.rs -new file mode 100644 -index 00000000..52a68a7b ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_double_config; -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config/_simple_double_config.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config/_simple_double_config.rs -new file mode 100644 -index 00000000..f726f08b ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/conversions/simple_double_config/_simple_double_config.rs -@@ -0,0 +1,19 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::types::simple_double_config::SimpleDoubleConfig, -+) -> ::std::rc::Rc< -+ crate::simple::types::smithydouble::internaldafny::types::SimpleDoubleConfig, -+> { -+ ::std::rc::Rc::new(crate::r#simple::types::smithydouble::internaldafny::types::SimpleDoubleConfig::SimpleDoubleConfig {}) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::smithydouble::internaldafny::types::SimpleDoubleConfig, -+ >, -+) -> crate::types::simple_double_config::SimpleDoubleConfig { -+ crate::types::simple_double_config::SimpleDoubleConfig {} -+} -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/implementation_from_dafny.rs -index f09879fc..e2aff694 100644 ---- b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,22 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+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; -+mod standard_library_conversions; -+ -+pub use client::Client; -+pub use types::simple_double_config::SimpleDoubleConfig; -+ -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/lib.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..94379fc0 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/lib.rs -@@ -0,0 +1,19 @@ -+#![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 b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..134175f8 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetDouble` operation. -+pub mod get_double; -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double.rs -new file mode 100644 -index 00000000..8b6d980d ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double.rs -@@ -0,0 +1,145 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetDouble`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetDouble; -+impl GetDouble { -+ /// Creates a new `GetDouble` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_double::GetDoubleInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_double::GetDoubleOutput, -+ crate::operation::get_double::GetDoubleError, -+ > { -+ let inner_input = crate::conversions::get_double::_get_double_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetDouble(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_double::_get_double_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_double::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetDouble` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetDoubleError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetDoubleError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetDoubleError { -+ /// Creates the `GetDoubleError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetDoubleError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetDoubleError { -+ 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 GetDoubleError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetDoubleError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetDoubleError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetDoubleError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_double::_get_double_output::GetDoubleOutput; -+ -+pub use crate::operation::get_double::_get_double_input::GetDoubleInput; -+ -+mod _get_double_input; -+ -+mod _get_double_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_input.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_input.rs -new file mode 100644 -index 00000000..af1cc410 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_input.rs -@@ -0,0 +1,56 @@ -+// 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 GetDoubleInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option, -+} -+impl GetDoubleInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option<&f64> { -+ self.value.as_ref() -+ } -+} -+impl GetDoubleInput { -+ /// Creates a new builder-style object to manufacture [`GetDoubleInput`](crate::operation::operation::GetDoubleInput). -+ pub fn builder() -> crate::operation::get_double::builders::GetDoubleInputBuilder { -+ crate::operation::get_double::builders::GetDoubleInputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetDoubleInput`](crate::operation::operation::GetDoubleInput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetDoubleInputBuilder { -+ pub(crate) value: ::std::option::Option, -+} -+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 -+ } -+ /// Consumes the builder and constructs a [`GetDoubleInput`](crate::operation::operation::GetDoubleInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_double::GetDoubleInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_double::GetDoubleInput { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_output.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_output.rs -new file mode 100644 -index 00000000..bf850acd ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/_get_double_output.rs -@@ -0,0 +1,62 @@ -+// 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 GetDoubleOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option, -+} -+ -+impl GetDoubleOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option { -+ 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 { -+ crate::operation::get_double::builders::GetDoubleOutputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetDoubleOutput`](crate::operation::operation::GetDoubleOutput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetDoubleOutputBuilder { -+ pub(crate) value: ::std::option::Option, -+} -+ -+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 -+ } -+ -+ /// Consumes the builder and constructs a [`GetDoubleOutput`](crate::operation::operation::GetDoubleOutput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_double::GetDoubleOutput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_double::GetDoubleOutput { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/builders.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/builders.rs -new file mode 100644 -index 00000000..ed9fd9a4 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/operation/get_double/builders.rs -@@ -0,0 +1,72 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_double::_get_double_output::GetDoubleOutputBuilder; -+ -+pub use crate::operation::get_double::_get_double_input::GetDoubleInputBuilder; -+ -+impl GetDoubleInputBuilder { -+ /// 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_double::GetDoubleOutput, -+ crate::operation::get_double::GetDoubleError, -+ > { -+ let mut fluent_builder = client.get_double(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetDouble`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetDoubleFluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::get_double::builders::GetDoubleInputBuilder, -+} -+impl GetDoubleFluentBuilder { -+ /// Creates a new `GetDouble`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetDouble as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_double::builders::GetDoubleInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_double::GetDoubleOutput, -+ crate::operation::get_double::GetDoubleError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetDouble 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_double::GetDoubleError::unhandled)?; -+ crate::operation::get_double::GetDouble::send(&self.client, input).await -+ } -+ -+ #[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() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/standard_library_conversions.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/standard_library_conversions.rs -new file mode 100644 -index 00000000..2fec0ffb ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/standard_library_conversions.rs -@@ -0,0 +1,246 @@ -+pub fn ostring_to_dafny( -+ input: &Option, -+) -> ::std::rc::Rc< -+ 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 {}, -+}; -+ ::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>>, -+ >, -+) -> 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 -+ } -+} -+ -+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 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) -+} -+ -+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 -+ } -+} -+ -+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 blob_to_dafny( -+ input: &::aws_smithy_types::Blob, -+) -> ::dafny_runtime::Sequence { -+ ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) -+} -+ -+pub fn oblob_to_dafny( -+ 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) -+} -+ -+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>>, -+) -> Option<::aws_smithy_types::Blob> { -+ 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 odouble_to_dafny( -+ 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) -+} -+ -+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>>, -+) -> Option { -+ 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, -+) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { -+ ::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) -+} -+ -+pub fn timestamp_from_dafny( -+ 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() -+} -+ -+pub fn otimestamp_from_dafny( -+ input: ::std::rc::Rc>>, -+) -> Option<::aws_smithy_types::DateTime> { -+ 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, -+) -> Option { -+ 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, -+) -> ::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 {} -+ ), -+ } -+} -+ -+pub fn result_from_dafny( -+ 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)), -+ } -+} -+ -+pub fn result_to_dafny( -+ 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 -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..92447294 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `SimpleDoubleConfig` -+pub mod simple_double_config; -diff --git b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types/simple_double_config.rs a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types/simple_double_config.rs -new file mode 100644 -index 00000000..b7766562 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/types/simple_double_config.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleDoubleConfig {} -+ -+impl SimpleDoubleConfig { -+ pub fn builder() -> SimpleDoubleConfigBuilder { -+ SimpleDoubleConfigBuilder::new() -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleDoubleConfigBuilder {} -+ -+impl SimpleDoubleConfigBuilder { -+ /// Creates a new `SimpleDoubleConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self {} -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result -+ { -+ ::std::result::Result::Ok(SimpleDoubleConfig {}) -+ } -+} diff --git a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/implementation_from_dafny.rs index e2aff6944..c2b5e1b56 100644 --- a/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/SimpleTypes/SimpleDouble/runtimes/rust/src/implementation_from_dafny.rs @@ -13,10 +13,12 @@ pub mod operation; mod conversions; mod standard_library_conversions; +#[cfg(feature = "wrapped-client")] +pub mod wrapped; + pub use client::Client; pub use types::simple_double_config::SimpleDoubleConfig; - pub mod r#_Wrappers_Compile { pub use dafny_runtime::DafnyPrint; pub use std::cmp::Eq; diff --git a/TestModels/SimpleTypes/SimpleEnum/Makefile b/TestModels/SimpleTypes/SimpleEnum/Makefile index 766ae13fb..dbc0a9220 100644 --- a/TestModels/SimpleTypes/SimpleEnum/Makefile +++ b/TestModels/SimpleTypes/SimpleEnum/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../../SharedMakefile.mk NAMESPACE=simple.types.smithyEnum diff --git a/TestModels/SimpleTypes/SimpleEnum/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/SimpleTypes/SimpleEnum/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index a04035865..000000000 --- a/TestModels/SimpleTypes/SimpleEnum/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,2519 +0,0 @@ -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..9649346b ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client.rs -@@ -0,0 +1,41 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ pub fn from_conf( -+ conf: crate::types::simple_enum_config::SimpleEnumConfig, -+ ) -> Result { -+ let inner = -+ crate::simple::types::smithyenum::internaldafny::_default::SimpleEnum( -+ &crate::conversions::simple_enum_config::_simple_enum_config::to_dafny(conf), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+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 b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum.rs -new file mode 100644 -index 00000000..f0c39525 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum.rs -@@ -0,0 +1,13 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+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)
-+ /// - On success, responds with [`GetEnumOutput`](crate::operation::get_enum::GetEnumOutput) with field(s): -+ /// - [`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 b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_first_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_first_known_value_test.rs -new file mode 100644 -index 00000000..a169931d ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_first_known_value_test.rs -@@ -0,0 +1,18 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetEnum`](crate::operation::get_enum_first_known_value::builders::GetEnumFluentBuilder) 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(), -+ ) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_second_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_second_known_value_test.rs -new file mode 100644 -index 00000000..8e4ec068 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_second_known_value_test.rs -@@ -0,0 +1,18 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetEnum`](crate::operation::get_enum_second_known_value::builders::GetEnumFluentBuilder) 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(), -+ ) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_third_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_third_known_value_test.rs -new file mode 100644 -index 00000000..47bdeb2f ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/client/get_enum_third_known_value_test.rs -@@ -0,0 +1,18 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetEnum`](crate::operation::get_enum_third_known_value::builders::GetEnumFluentBuilder) 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(), -+ ) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..7361ee56 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions.rs -@@ -0,0 +1,9 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_enum; -+ -+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 b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum.rs -new file mode 100644 -index 00000000..ef493d11 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum.rs -@@ -0,0 +1,32 @@ -+// 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_enum::GetEnumError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_enum::GetEnumError::Unhandled(unhandled) => -+ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::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::smithyenum::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_enum::GetEnumError { -+ // 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::smithyenum::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_enum::GetEnumError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_enum::GetEnumError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_enum_input; -+ -+pub mod _get_enum_output; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_input.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_input.rs -new file mode 100644 -index 00000000..3bbf1602 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_input.rs -@@ -0,0 +1,45 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_output.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_output.rs -new file mode 100644 -index 00000000..1ae04378 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum/_get_enum_output.rs -@@ -0,0 +1,45 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test.rs -new file mode 100644 -index 00000000..5e3e946f ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test.rs -@@ -0,0 +1,32 @@ -+// 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_enum_first_known_value_test::GetEnumFirstKnownValueTestError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestError::Unhandled(unhandled) => -+ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::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::smithyenum::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestError { -+ // 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::smithyenum::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_enum_first_known_value_test_input; -+ -+pub mod _get_enum_first_known_value_test_output; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs -new file mode 100644 -index 00000000..45398964 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs -@@ -0,0 +1,45 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestInput, -+) -> ::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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs -new file mode 100644 -index 00000000..c31403c9 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs -@@ -0,0 +1,45 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestOutput, -+) -> ::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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test.rs -new file mode 100644 -index 00000000..afa0c42c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test.rs -@@ -0,0 +1,32 @@ -+// 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_enum_second_known_value_test::GetEnumSecondKnownValueTestError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestError::Unhandled(unhandled) => -+ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::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::smithyenum::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestError { -+ // 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::smithyenum::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_enum_second_known_value_test_input; -+ -+pub mod _get_enum_second_known_value_test_output; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs -new file mode 100644 -index 00000000..c73d8a63 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs -@@ -0,0 +1,45 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestInput, -+) -> ::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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs -new file mode 100644 -index 00000000..fbb2809e ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs -@@ -0,0 +1,45 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestOutput, -+) -> ::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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test.rs -new file mode 100644 -index 00000000..b3d8d118 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test.rs -@@ -0,0 +1,32 @@ -+// 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_enum_third_known_value_test::GetEnumThirdKnownValueTestError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestError::Unhandled(unhandled) => -+ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::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::smithyenum::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestError { -+ // 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::smithyenum::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_enum_third_known_value_test_input; -+ -+pub mod _get_enum_third_known_value_test_output; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs -new file mode 100644 -index 00000000..73c9d9b6 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs -@@ -0,0 +1,45 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestInput, -+) -> ::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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs -new file mode 100644 -index 00000000..aafc1403 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs -@@ -0,0 +1,45 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestOutput, -+) -> ::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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config.rs -new file mode 100644 -index 00000000..973679ee ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_enum_config; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config/_simple_enum_config.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config/_simple_enum_config.rs -new file mode 100644 -index 00000000..a1e48e7f ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_config/_simple_enum_config.rs -@@ -0,0 +1,19 @@ -+// 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_config::SimpleEnumConfig, -+) -> ::std::rc::Rc< -+ crate::simple::types::smithyenum::internaldafny::types::SimpleEnumConfig, -+> { -+ ::std::rc::Rc::new(crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumConfig::SimpleEnumConfig {}) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::smithyenum::internaldafny::types::SimpleEnumConfig, -+ >, -+) -> crate::types::simple_enum_config::SimpleEnumConfig { -+ crate::types::simple_enum_config::SimpleEnumConfig {} -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape.rs -new file mode 100644 -index 00000000..f531b553 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_enum_shape; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape/_simple_enum_shape.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape/_simple_enum_shape.rs -new file mode 100644 -index 00000000..8519605a ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/conversions/simple_enum_shape/_simple_enum_shape.rs -@@ -0,0 +1,23 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/implementation_from_dafny.rs -index 124e031e..c56fd3f3 100644 ---- b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,21 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+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_enum_config::SimpleEnumConfig; -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/lib.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..f914e7ba ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/lib.rs -@@ -0,0 +1,19 @@ -+#![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 b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..560af271 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation.rs -@@ -0,0 +1,9 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetEnum` operation. -+pub mod get_enum; -+ -+/// Types for the `GetEnumKnownValue` operation. -+pub mod get_enum_first_known_value_test; -+pub mod get_enum_second_known_value_test; -+pub mod get_enum_third_known_value_test; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum.rs -new file mode 100644 -index 00000000..d75b5ac4 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum.rs -@@ -0,0 +1,142 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetEnum`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetEnum; -+impl GetEnum { -+ /// Creates a new `GetEnum` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_enum::GetEnumInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_enum::GetEnumOutput, -+ 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); -+ 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(), -+ )) -+ } else { -+ Err(crate::conversions::get_enum::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetEnum` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetEnumError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetEnumError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetEnumError { -+ /// Creates the `GetEnumError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetEnumError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetEnumError { -+ 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 GetEnumError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetEnumError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetEnumError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetEnumError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_enum::_get_enum_output::GetEnumOutput; -+ -+pub use crate::operation::get_enum::_get_enum_input::GetEnumInput; -+ -+mod _get_enum_input; -+ -+mod _get_enum_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_input.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_input.rs -new file mode 100644 -index 00000000..37b1f16c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_input.rs -@@ -0,0 +1,65 @@ -+// 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 GetEnumInput { -+ #[allow(missing_docs)] // documentation missing in model -+ 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() -+ } -+} -+impl GetEnumInput { -+ /// Creates a new builder-style object to manufacture [`GetEnumInput`](crate::operation::operation::GetEnumInput). -+ pub fn builder() -> crate::operation::get_enum::builders::GetEnumInputBuilder { -+ crate::operation::get_enum::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::GetEnumInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_enum::GetEnumInput { value: self.value }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_output.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_output.rs -new file mode 100644 -index 00000000..9675cc2c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/_get_enum_output.rs -@@ -0,0 +1,69 @@ -+// 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 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 -+ } -+} -+ -+impl GetEnumOutput { -+ /// Creates a new builder-style object to manufacture [`GetEnumOutput`](crate::operation::operation::GetEnumOutput). -+ pub fn builder() -> crate::operation::get_enum::builders::GetEnumOutputBuilder { -+ crate::operation::get_enum::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::GetEnumOutput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_enum::GetEnumOutput { value: self.value }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/builders.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/builders.rs -new file mode 100644 -index 00000000..11e371c1 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum/builders.rs -@@ -0,0 +1,76 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_enum::_get_enum_input::GetEnumInputBuilder; -+pub use crate::operation::get_enum::_get_enum_output::GetEnumOutputBuilder; -+ -+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::GetEnumOutput, -+ crate::operation::get_enum::GetEnumError, -+ > { -+ let mut fluent_builder = client.get_enum(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetEnum`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetEnumFluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::get_enum::builders::GetEnumInputBuilder, -+} -+impl GetEnumFluentBuilder { -+ /// Creates a new `GetEnum`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetEnum as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_enum::builders::GetEnumInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_enum::GetEnumOutput, -+ crate::operation::get_enum::GetEnumError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetEnum 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::GetEnumError::unhandled)?; -+ crate::operation::get_enum::GetEnum::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() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test.rs -new file mode 100644 -index 00000000..106ec170 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test.rs -@@ -0,0 +1,149 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetEnumFirstKnownValueTest`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetEnumFirstKnownValueTest; -+impl GetEnumFirstKnownValueTest { -+ /// Creates a new `GetEnumFirstKnownValueTest` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_enum_first_known_value_test::GetEnumFirstKnownValueTestOutput, -+ 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); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_enum_first_known_value_test::_get_enum_first_known_value_test_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err( -+ crate::conversions::get_enum_first_known_value_test::from_dafny_error( -+ inner_result.error().clone(), -+ ), -+ ) -+ } -+ } -+} -+ -+/// Error type for the `GetEnumFirstKnownValueTest` operation. -+#[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). -+ #[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+ variable wildcard pattern and check `.code()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetEnumFirstKnownValueTestError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetEnumFirstKnownValueTestError { -+ /// Creates the `GetEnumFirstKnownValueTestError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetEnumFirstKnownValueTestError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetEnumFirstKnownValueTestError { -+ 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 GetEnumFirstKnownValueTestError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetEnumFirstKnownValueTestError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetEnumFirstKnownValueTestError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+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, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+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_first_known_value_test_input::GetEnumFirstKnownValueTestInput; -+ -+mod _get_enum_first_known_value_test_input; -+ -+mod _get_enum_first_known_value_test_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs -new file mode 100644 -index 00000000..86672755 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_input.rs -@@ -0,0 +1,69 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs -new file mode 100644 -index 00000000..65154c96 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/_get_enum_first_known_value_test_output.rs -@@ -0,0 +1,69 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/builders.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/builders.rs -new file mode 100644 -index 00000000..ca84c977 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_first_known_value_test/builders.rs -@@ -0,0 +1,84 @@ -+// 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; -+ -+impl GetEnumFirstKnownValueTestInputBuilder { -+ /// 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::GetEnumFirstKnownValueTestError, -+ > { -+ let mut fluent_builder = client.get_enum_first_known_value_test(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetEnumFirstKnownValueTest`. -+/// -+#[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, -+} -+impl GetEnumFirstKnownValueTestFluentBuilder { -+ /// Creates a new `GetEnumFirstKnownValueTest`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetEnumFirstKnownValueTest as a reference. -+ pub fn as_input( -+ &self, -+ ) -> &crate::operation::get_enum_first_known_value_test::builders::GetEnumFirstKnownValueTestInputBuilder -+ { -+ &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::GetEnumFirstKnownValueTestError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetEnum 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 -+ } -+ -+ #[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() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test.rs -new file mode 100644 -index 00000000..b59e0ce5 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test.rs -@@ -0,0 +1,151 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetEnumSecondKnownValueTest`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetEnumSecondKnownValueTest; -+impl GetEnumSecondKnownValueTest { -+ /// Creates a new `GetEnumSecondKnownValueTest` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_enum_second_known_value_test::GetEnumSecondKnownValueTestOutput, -+ 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); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_enum_second_known_value_test::_get_enum_second_known_value_test_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err( -+ crate::conversions::get_enum_second_known_value_test::from_dafny_error( -+ inner_result.error().clone(), -+ ), -+ ) -+ } -+ } -+} -+ -+/// Error type for the `GetEnumSecondKnownValueTest` operation. -+#[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). -+ #[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+ variable wildcard pattern and check `.code()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetEnumSecondKnownValueTestError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetEnumSecondKnownValueTestError { -+ /// Creates the `GetEnumSecondKnownValueTestError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetEnumSecondKnownValueTestError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetEnumSecondKnownValueTestError { -+ 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 GetEnumSecondKnownValueTestError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetEnumSecondKnownValueTestError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+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 -+{ -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+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_second_known_value_test_input::GetEnumSecondKnownValueTestInput; -+ -+mod _get_enum_second_known_value_test_input; -+ -+mod _get_enum_second_known_value_test_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs -new file mode 100644 -index 00000000..3fb03429 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_input.rs -@@ -0,0 +1,69 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs -new file mode 100644 -index 00000000..69370250 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/_get_enum_second_known_value_test_output.rs -@@ -0,0 +1,69 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/builders.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/builders.rs -new file mode 100644 -index 00000000..e54348b3 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_second_known_value_test/builders.rs -@@ -0,0 +1,83 @@ -+// 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; -+ -+impl GetEnumSecondKnownValueTestInputBuilder { -+ /// 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::GetEnumSecondKnownValueTestError, -+ > { -+ let mut fluent_builder = client.get_enum_second_known_value_test(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetEnumSecondKnownValueTest`. -+/// -+#[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, -+} -+impl GetEnumSecondKnownValueTestFluentBuilder { -+ /// Creates a new `GetEnumSecondKnownValueTest`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetEnumSecondKnownValueTest as a reference. -+ pub fn as_input( -+ &self, -+ ) -> &crate::operation::get_enum_second_known_value_test::builders::GetEnumSecondKnownValueTestInputBuilder -+ { -+ &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::GetEnumSecondKnownValueTestError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetEnum 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 -+ } -+ -+ #[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() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test.rs -new file mode 100644 -index 00000000..d5def6ff ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test.rs -@@ -0,0 +1,149 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetEnumThirdKnownValueTest`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetEnumThirdKnownValueTest; -+impl GetEnumThirdKnownValueTest { -+ /// Creates a new `GetEnumThirdKnownValueTest` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_enum_third_known_value_test::GetEnumThirdKnownValueTestOutput, -+ 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); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_enum_third_known_value_test::_get_enum_third_known_value_test_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err( -+ crate::conversions::get_enum_third_known_value_test::from_dafny_error( -+ inner_result.error().clone(), -+ ), -+ ) -+ } -+ } -+} -+ -+/// Error type for the `GetEnumThirdKnownValueTest` operation. -+#[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). -+ #[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+ variable wildcard pattern and check `.code()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetEnumThirdKnownValueTestError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetEnumThirdKnownValueTestError { -+ /// Creates the `GetEnumThirdKnownValueTestError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetEnumThirdKnownValueTestError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetEnumThirdKnownValueTestError { -+ 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 GetEnumThirdKnownValueTestError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetEnumThirdKnownValueTestError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetEnumThirdKnownValueTestError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+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, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+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_third_known_value_test_input::GetEnumThirdKnownValueTestInput; -+ -+mod _get_enum_third_known_value_test_input; -+ -+mod _get_enum_third_known_value_test_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs -new file mode 100644 -index 00000000..275d472c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_input.rs -@@ -0,0 +1,68 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs -new file mode 100644 -index 00000000..e1d498d3 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/_get_enum_third_known_value_test_output.rs -@@ -0,0 +1,69 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/builders.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/builders.rs -new file mode 100644 -index 00000000..db835240 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/operation/get_enum_third_known_value_test/builders.rs -@@ -0,0 +1,84 @@ -+// 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; -+ -+impl GetEnumThirdKnownValueTestInputBuilder { -+ /// 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::GetEnumThirdKnownValueTestError, -+ > { -+ let mut fluent_builder = client.get_enum_third_known_value_test(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetEnumThirdKnownValueTest`. -+/// -+#[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, -+} -+impl GetEnumThirdKnownValueTestFluentBuilder { -+ /// Creates a new `GetEnumThirdKnownValueTest`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetEnumThirdKnownValueTest as a reference. -+ pub fn as_input( -+ &self, -+ ) -> &crate::operation::get_enum_third_known_value_test::builders::GetEnumThirdKnownValueTestInputBuilder -+ { -+ &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::GetEnumThirdKnownValueTestError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetEnum 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 -+ } -+ -+ #[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() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..de391012 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types.rs -@@ -0,0 +1,5 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `SimpleIntegerConfig` -+pub mod simple_enum_config; -+pub mod simple_enum_shape; -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_config.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_config.rs -new file mode 100644 -index 00000000..fd3ea0e1 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_config.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleEnumConfig {} -+ -+impl SimpleEnumConfig { -+ pub fn builder() -> SimpleEnumConfigBuilder { -+ SimpleEnumConfigBuilder::new() -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleEnumConfigBuilder {} -+ -+impl SimpleEnumConfigBuilder { -+ /// Creates a new `SimpleEnumConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self {} -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result -+ { -+ ::std::result::Result::Ok(SimpleEnumConfig {}) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_shape.rs a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_shape.rs -new file mode 100644 -index 00000000..dba31405 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/types/simple_enum_shape.rs -@@ -0,0 +1,6 @@ -+#[derive(Debug, PartialEq, Copy, Clone)] -+pub enum SimpleEnumShape { -+ FIRST, -+ SECOND, -+ THIRD, -+} diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/implementation_from_dafny.rs index c56fd3f3a..f09f3d103 100644 --- a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/implementation_from_dafny.rs @@ -11,7 +11,10 @@ pub mod error; pub mod operation; mod conversions; +mod standard_library_conversions; +#[cfg(feature = "wrapped-client")] +pub mod wrapped; pub use client::Client; pub use types::simple_enum_config::SimpleEnumConfig; diff --git a/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/standard_library_conversions.rs new file mode 100644 index 000000000..2fec0ffb5 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnum/runtimes/rust/src/standard_library_conversions.rs @@ -0,0 +1,246 @@ +pub fn ostring_to_dafny( + input: &Option, +) -> ::std::rc::Rc< + 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 {}, +}; + ::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>>, + >, +) -> 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 + } +} + +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 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) +} + +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 + } +} + +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 blob_to_dafny( + input: &::aws_smithy_types::Blob, +) -> ::dafny_runtime::Sequence { + ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) +} + +pub fn oblob_to_dafny( + 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) +} + +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>>, +) -> Option<::aws_smithy_types::Blob> { + 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 odouble_to_dafny( + 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) +} + +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>>, +) -> Option { + 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, +) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { + ::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) +} + +pub fn timestamp_from_dafny( + 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() +} + +pub fn otimestamp_from_dafny( + input: ::std::rc::Rc>>, +) -> Option<::aws_smithy_types::DateTime> { + 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, +) -> Option { + 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, +) -> ::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 {} + ), + } +} + +pub fn result_from_dafny( + 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)), + } +} + +pub fn result_to_dafny( + 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 diff --git a/TestModels/SimpleTypes/SimpleEnumV2/Makefile b/TestModels/SimpleTypes/SimpleEnumV2/Makefile index c759952d6..01a9a8612 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/Makefile +++ b/TestModels/SimpleTypes/SimpleEnumV2/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../../SharedMakefile.mk NAMESPACE=simple.types.enumV2 diff --git a/TestModels/SimpleTypes/SimpleEnumV2/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/SimpleTypes/SimpleEnumV2/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index 6efd51ecc..000000000 --- a/TestModels/SimpleTypes/SimpleEnumV2/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,2563 +0,0 @@ -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..f7bbdbfa ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client.rs -@@ -0,0 +1,41 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ pub fn from_conf( -+ conf: crate::types::simple_enum_v2_config::SimpleEnumV2Config, -+ ) -> Result { -+ let inner = -+ crate::simple::types::enumv2::internaldafny::_default::SimpleEnumV2( -+ &crate::conversions::simple_enum_v2_config::_simple_enum_v2_config::to_dafny(conf), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+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 b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2.rs -new file mode 100644 -index 00000000..c9a688bd ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2.rs -@@ -0,0 +1,13 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+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)
-+ /// - On success, responds with [`GetEnumV2Output`](crate::operation::get_enum_v2::GetEnumV2Output) with field(s): -+ /// - [`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 b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_first_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_first_known_value_test.rs -new file mode 100644 -index 00000000..ebde767b ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_first_known_value_test.rs -@@ -0,0 +1,18 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetEnumV2`](crate::operation::get_enum_v2_first_known_value::builders::GetEnumV2FluentBuilder) 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(), -+ ) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_second_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_second_known_value_test.rs -new file mode 100644 -index 00000000..f4981c29 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_second_known_value_test.rs -@@ -0,0 +1,18 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetEnumV2`](crate::operation::get_enum_v2_second_known_value::builders::GetEnumV2FluentBuilder) 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(), -+ ) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_third_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_third_known_value_test.rs -new file mode 100644 -index 00000000..afc875f3 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/client/get_enum_v2_third_known_value_test.rs -@@ -0,0 +1,18 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetEnumV2`](crate::operation::get_enum_v2_third_known_value::builders::GetEnumV2FluentBuilder) 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(), -+ ) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..323761ef ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions.rs -@@ -0,0 +1,9 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_enum_v2; -+ -+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 b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2.rs -new file mode 100644 -index 00000000..e9b9909b ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2.rs -@@ -0,0 +1,37 @@ -+// 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_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), -+ ), -+ }, -+ ), -+ } -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny_error( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::enumv2::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_enum_v2::GetEnumV2Error { -+ // 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::enumv2::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_enum_v2::GetEnumV2Error::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_enum_v2::GetEnumV2Error::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_enum_v2_input; -+ -+pub mod _get_enum_v2_output; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_input.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_input.rs -new file mode 100644 -index 00000000..236bf355 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_input.rs -@@ -0,0 +1,45 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_output.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_output.rs -new file mode 100644 -index 00000000..84d950d9 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2/_get_enum_v2_output.rs -@@ -0,0 +1,45 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test.rs -new file mode 100644 -index 00000000..9e850944 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test.rs -@@ -0,0 +1,32 @@ -+// 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_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestError::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)] -+pub fn from_dafny_error( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::enumv2::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestError { -+ // 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::enumv2::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_enum_v2_first_known_value_test_input; -+ -+pub mod _get_enum_v2_first_known_value_test_output; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs -new file mode 100644 -index 00000000..043d6933 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs -@@ -0,0 +1,47 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestInput, -+) -> ::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) -+ }) -+} -+ -+#[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, -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs -new file mode 100644 -index 00000000..7378e117 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs -@@ -0,0 +1,47 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestOutput, -+) -> ::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) -+ }) -+} -+ -+#[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, -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test.rs -new file mode 100644 -index 00000000..b6de63fa ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test.rs -@@ -0,0 +1,32 @@ -+// 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_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestError::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)] -+pub fn from_dafny_error( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::enumv2::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestError { -+ // 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::enumv2::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_enum_v2_second_known_value_test_input; -+ -+pub mod _get_enum_v2_second_known_value_test_output; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs -new file mode 100644 -index 00000000..a7a40bf4 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs -@@ -0,0 +1,47 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestInput, -+) -> ::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) -+ }) -+} -+ -+#[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, -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs -new file mode 100644 -index 00000000..07bec266 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs -@@ -0,0 +1,47 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestOutput, -+) -> ::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) -+ }) -+} -+ -+#[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, -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test.rs -new file mode 100644 -index 00000000..a1ddd7da ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test.rs -@@ -0,0 +1,32 @@ -+// 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_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestError::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)] -+pub fn from_dafny_error( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::enumv2::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestError { -+ // 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::enumv2::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_enum_v2_third_known_value_test_input; -+ -+pub mod _get_enum_v2_third_known_value_test_output; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs -new file mode 100644 -index 00000000..8adc054b ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs -@@ -0,0 +1,47 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestInput, -+) -> ::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) -+ }) -+} -+ -+#[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, -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs -new file mode 100644 -index 00000000..1607c800 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs -@@ -0,0 +1,47 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestOutput, -+) -> ::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) -+ }) -+} -+ -+#[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, -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config.rs -new file mode 100644 -index 00000000..3eaacd61 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_enum_v2_config; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config/_simple_enum_v2_config.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config/_simple_enum_v2_config.rs -new file mode 100644 -index 00000000..f0a68045 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_config/_simple_enum_v2_config.rs -@@ -0,0 +1,19 @@ -+// 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_config::SimpleEnumV2Config, -+) -> ::std::rc::Rc< -+ crate::simple::types::enumv2::internaldafny::types::SimpleEnumV2Config, -+> { -+ ::std::rc::Rc::new(crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Config::SimpleEnumV2Config {}) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::enumv2::internaldafny::types::SimpleEnumV2Config, -+ >, -+) -> crate::types::simple_enum_v2_config::SimpleEnumV2Config { -+ crate::types::simple_enum_v2_config::SimpleEnumV2Config {} -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape.rs -new file mode 100644 -index 00000000..b4f4a50f ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_enum_v2_shape; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape/_simple_enum_v2_shape.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape/_simple_enum_v2_shape.rs -new file mode 100644 -index 00000000..d48a6337 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/conversions/simple_enum_v2_shape/_simple_enum_v2_shape.rs -@@ -0,0 +1,23 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/implementation_from_dafny.rs -index a4aa104f..5dcd7a05 100644 ---- b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,20 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+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_enum_v2_config::SimpleEnumV2Config; -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/lib.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..fcb015ba ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/lib.rs -@@ -0,0 +1,19 @@ -+#![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 b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..565298a1 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation.rs -@@ -0,0 +1,9 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetEnumV2` operation. -+pub mod get_enum_v2; -+ -+/// Types for the `GetEnumV2KnownValue` operation. -+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; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2.rs -new file mode 100644 -index 00000000..f556fbe3 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2.rs -@@ -0,0 +1,145 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetEnumV2`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetEnumV2; -+impl GetEnumV2 { -+ /// Creates a new `GetEnumV2` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_enum_v2::GetEnumV2Input, -+ ) -> ::std::result::Result< -+ crate::operation::get_enum_v2::GetEnumV2Output, -+ crate::operation::get_enum_v2::GetEnumV2Error, -+ > { -+ let inner_input = crate::conversions::get_enum_v2::_get_enum_v2_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumV2(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_enum_v2::_get_enum_v2_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_enum_v2::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetEnumV2` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetEnumV2Error { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetEnumV2Error) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetEnumV2Error { -+ /// Creates the `GetEnumV2Error::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetEnumV2Error::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetEnumV2Error { -+ 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 GetEnumV2Error { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetEnumV2Error { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetEnumV2Error { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetEnumV2Error { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+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; -+ -+mod _get_enum_v2_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_input.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_input.rs -new file mode 100644 -index 00000000..a8420226 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_input.rs -@@ -0,0 +1,67 @@ -+// 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 GetEnumV2Input { -+ #[allow(missing_docs)] // documentation missing in model -+ 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() -+ } -+} -+impl GetEnumV2Input { -+ /// Creates a new builder-style object to manufacture [`GetEnumV2Input`](crate::operation::operation::GetEnumV2Input). -+ pub fn builder() -> crate::operation::get_enum_v2::builders::GetEnumV2InputBuilder { -+ crate::operation::get_enum_v2::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::GetEnumV2Input, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_enum_v2::GetEnumV2Input { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_output.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_output.rs -new file mode 100644 -index 00000000..002769f6 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/_get_enum_v2_output.rs -@@ -0,0 +1,73 @@ -+// 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 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 -+ } -+} -+ -+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 { -+ crate::operation::get_enum_v2::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::GetEnumV2Output, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_enum_v2::GetEnumV2Output { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/builders.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/builders.rs -new file mode 100644 -index 00000000..e742b3d9 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2/builders.rs -@@ -0,0 +1,76 @@ -+// 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; -+pub use crate::operation::get_enum_v2::_get_enum_v2_output::GetEnumV2OutputBuilder; -+ -+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::GetEnumV2Output, -+ crate::operation::get_enum_v2::GetEnumV2Error, -+ > { -+ let mut fluent_builder = client.get_enum_v2(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetEnumV2`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetEnumV2FluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::get_enum_v2::builders::GetEnumV2InputBuilder, -+} -+impl GetEnumV2FluentBuilder { -+ /// Creates a new `GetEnumV2`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetEnumV2 as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_enum_v2::builders::GetEnumV2InputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_enum_v2::GetEnumV2Output, -+ crate::operation::get_enum_v2::GetEnumV2Error, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetEnumV2 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::GetEnumV2Error::unhandled)?; -+ crate::operation::get_enum_v2::GetEnumV2::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() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test.rs -new file mode 100644 -index 00000000..57c67e00 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test.rs -@@ -0,0 +1,152 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetEnumV2FirstKnownValueTest`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetEnumV2FirstKnownValueTest; -+impl GetEnumV2FirstKnownValueTest { -+ /// Creates a new `GetEnumV2FirstKnownValueTest` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_enum_v2_first_known_value_test::GetEnumV2FirstKnownValueTestOutput, -+ 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_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumV2(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_enum_v2_first_known_value_test::_get_enum_v2_first_known_value_test_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err( -+ crate::conversions::get_enum_v2_first_known_value_test::from_dafny_error( -+ inner_result.error().clone(), -+ ), -+ ) -+ } -+ } -+} -+ -+/// Error type for the `GetEnumV2FirstKnownValueTest` operation. -+#[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). -+ #[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+ variable wildcard pattern and check `.code()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetEnumV2FirstKnownValueTestError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetEnumV2FirstKnownValueTestError { -+ /// Creates the `GetEnumV2FirstKnownValueTestError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetEnumV2FirstKnownValueTestError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetEnumV2FirstKnownValueTestError { -+ 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 GetEnumV2FirstKnownValueTestError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetEnumV2FirstKnownValueTestError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+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 -+{ -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+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_first_known_value_test_input::GetEnumV2FirstKnownValueTestInput; -+ -+mod _get_enum_v2_first_known_value_test_input; -+ -+mod _get_enum_v2_first_known_value_test_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs -new file mode 100644 -index 00000000..a367fd77 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_input.rs -@@ -0,0 +1,71 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs -new file mode 100644 -index 00000000..f665704a ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/_get_enum_v2_first_known_value_test_output.rs -@@ -0,0 +1,71 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/builders.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/builders.rs -new file mode 100644 -index 00000000..c88ff6ef ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_first_known_value_test/builders.rs -@@ -0,0 +1,84 @@ -+// 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; -+ -+impl GetEnumV2FirstKnownValueTestInputBuilder { -+ /// 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::GetEnumV2FirstKnownValueTestError, -+ > { -+ let mut fluent_builder = client.get_enum_v2_first_known_value_test(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetEnumV2FirstKnownValueTest`. -+/// -+#[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, -+} -+impl GetEnumV2FirstKnownValueTestFluentBuilder { -+ /// Creates a new `GetEnumV2FirstKnownValueTest`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetEnumV2FirstKnownValueTest as a reference. -+ pub fn as_input( -+ &self, -+ ) -> &crate::operation::get_enum_v2_first_known_value_test::builders::GetEnumV2FirstKnownValueTestInputBuilder -+ { -+ &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::GetEnumV2FirstKnownValueTestError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetEnumV2 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 -+ } -+ -+ #[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() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test.rs -new file mode 100644 -index 00000000..9fecf26d ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test.rs -@@ -0,0 +1,152 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetEnumV2SecondKnownValueTest`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetEnumV2SecondKnownValueTest; -+impl GetEnumV2SecondKnownValueTest { -+ /// Creates a new `GetEnumV2SecondKnownValueTest` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_enum_v2_second_known_value_test::GetEnumV2SecondKnownValueTestOutput, -+ 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_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumV2(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_enum_v2_second_known_value_test::_get_enum_v2_second_known_value_test_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err( -+ crate::conversions::get_enum_v2_second_known_value_test::from_dafny_error( -+ inner_result.error().clone(), -+ ), -+ ) -+ } -+ } -+} -+ -+/// Error type for the `GetEnumV2SecondKnownValueTest` operation. -+#[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). -+ #[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+ variable wildcard pattern and check `.code()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetEnumV2SecondKnownValueTestError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetEnumV2SecondKnownValueTestError { -+ /// Creates the `GetEnumV2SecondKnownValueTestError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetEnumV2SecondKnownValueTestError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetEnumV2SecondKnownValueTestError { -+ 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 GetEnumV2SecondKnownValueTestError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetEnumV2SecondKnownValueTestError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+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 -+{ -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+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_second_known_value_test_input::GetEnumV2SecondKnownValueTestInput; -+ -+mod _get_enum_v2_second_known_value_test_input; -+ -+mod _get_enum_v2_second_known_value_test_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs -new file mode 100644 -index 00000000..d13dfd18 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_input.rs -@@ -0,0 +1,71 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs -new file mode 100644 -index 00000000..39218e3a ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/_get_enum_v2_second_known_value_test_output.rs -@@ -0,0 +1,71 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/builders.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/builders.rs -new file mode 100644 -index 00000000..5137b217 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_second_known_value_test/builders.rs -@@ -0,0 +1,83 @@ -+// 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; -+ -+impl GetEnumV2SecondKnownValueTestInputBuilder { -+ /// 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::GetEnumV2SecondKnownValueTestError, -+ > { -+ let mut fluent_builder = client.get_enum_v2_second_known_value_test(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetEnumV2SecondKnownValueTest`. -+/// -+#[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, -+} -+impl GetEnumV2SecondKnownValueTestFluentBuilder { -+ /// Creates a new `GetEnumV2SecondKnownValueTest`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetEnumV2SecondKnownValueTest as a reference. -+ pub fn as_input( -+ &self, -+ ) -> &crate::operation::get_enum_v2_second_known_value_test::builders::GetEnumV2SecondKnownValueTestInputBuilder -+ { -+ &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::GetEnumV2SecondKnownValueTestError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetEnumV2 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 -+ } -+ -+ #[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() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test.rs -new file mode 100644 -index 00000000..bf5efb30 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test.rs -@@ -0,0 +1,152 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetEnumV2ThirdKnownValueTest`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetEnumV2ThirdKnownValueTest; -+impl GetEnumV2ThirdKnownValueTest { -+ /// Creates a new `GetEnumV2ThirdKnownValueTest` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_enum_v2_third_known_value_test::GetEnumV2ThirdKnownValueTestOutput, -+ 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_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetEnumV2(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_enum_v2_third_known_value_test::_get_enum_v2_third_known_value_test_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err( -+ crate::conversions::get_enum_v2_third_known_value_test::from_dafny_error( -+ inner_result.error().clone(), -+ ), -+ ) -+ } -+ } -+} -+ -+/// Error type for the `GetEnumV2ThirdKnownValueTest` operation. -+#[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). -+ #[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+ variable wildcard pattern and check `.code()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetEnumV2ThirdKnownValueTestError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetEnumV2ThirdKnownValueTestError { -+ /// Creates the `GetEnumV2ThirdKnownValueTestError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetEnumV2ThirdKnownValueTestError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetEnumV2ThirdKnownValueTestError { -+ 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 GetEnumV2ThirdKnownValueTestError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetEnumV2ThirdKnownValueTestError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+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 -+{ -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+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_third_known_value_test_input::GetEnumV2ThirdKnownValueTestInput; -+ -+mod _get_enum_v2_third_known_value_test_input; -+ -+mod _get_enum_v2_third_known_value_test_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs -new file mode 100644 -index 00000000..573fb3c1 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_input.rs -@@ -0,0 +1,70 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs -new file mode 100644 -index 00000000..588e636c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/_get_enum_v2_third_known_value_test_output.rs -@@ -0,0 +1,71 @@ -+// 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 b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/builders.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/builders.rs -new file mode 100644 -index 00000000..f1bbbe05 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/operation/get_enum_v2_third_known_value_test/builders.rs -@@ -0,0 +1,84 @@ -+// 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; -+ -+impl GetEnumV2ThirdKnownValueTestInputBuilder { -+ /// 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::GetEnumV2ThirdKnownValueTestError, -+ > { -+ let mut fluent_builder = client.get_enum_v2_third_known_value_test(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetEnumV2ThirdKnownValueTest`. -+/// -+#[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, -+} -+impl GetEnumV2ThirdKnownValueTestFluentBuilder { -+ /// Creates a new `GetEnumV2ThirdKnownValueTest`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetEnumV2ThirdKnownValueTest as a reference. -+ pub fn as_input( -+ &self, -+ ) -> &crate::operation::get_enum_v2_third_known_value_test::builders::GetEnumV2ThirdKnownValueTestInputBuilder -+ { -+ &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::GetEnumV2ThirdKnownValueTestError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetEnumV2 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 -+ } -+ -+ #[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() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..951f1e5c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types.rs -@@ -0,0 +1,5 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `SimpleIntegerConfig` -+pub mod simple_enum_v2_config; -+pub mod simple_enum_v2_shape; -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_config.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_config.rs -new file mode 100644 -index 00000000..37b2d81a ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_config.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleEnumV2Config {} -+ -+impl SimpleEnumV2Config { -+ pub fn builder() -> SimpleEnumV2ConfigBuilder { -+ SimpleEnumV2ConfigBuilder::new() -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleEnumV2ConfigBuilder {} -+ -+impl SimpleEnumV2ConfigBuilder { -+ /// Creates a new `SimpleEnumV2ConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self {} -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result -+ { -+ ::std::result::Result::Ok(SimpleEnumV2Config {}) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_shape.rs a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_shape.rs -new file mode 100644 -index 00000000..b1eb3472 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/types/simple_enum_v2_shape.rs -@@ -0,0 +1,6 @@ -+#[derive(Debug, PartialEq, Copy, Clone)] -+pub enum SimpleEnumV2Shape { -+ FIRST, -+ SECOND, -+ THIRD, -+} diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/implementation_from_dafny.rs index 5dcd7a058..ba2b5a9bf 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/implementation_from_dafny.rs @@ -11,6 +11,10 @@ pub mod error; pub mod operation; mod conversions; +mod standard_library_conversions; + +#[cfg(feature = "wrapped-client")] +pub mod wrapped; pub use client::Client; pub use types::simple_enum_v2_config::SimpleEnumV2Config; diff --git a/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/standard_library_conversions.rs new file mode 100644 index 000000000..2fec0ffb5 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleEnumV2/runtimes/rust/src/standard_library_conversions.rs @@ -0,0 +1,246 @@ +pub fn ostring_to_dafny( + input: &Option, +) -> ::std::rc::Rc< + 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 {}, +}; + ::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>>, + >, +) -> 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 + } +} + +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 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) +} + +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 + } +} + +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 blob_to_dafny( + input: &::aws_smithy_types::Blob, +) -> ::dafny_runtime::Sequence { + ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) +} + +pub fn oblob_to_dafny( + 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) +} + +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>>, +) -> Option<::aws_smithy_types::Blob> { + 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 odouble_to_dafny( + 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) +} + +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>>, +) -> Option { + 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, +) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { + ::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) +} + +pub fn timestamp_from_dafny( + 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() +} + +pub fn otimestamp_from_dafny( + input: ::std::rc::Rc>>, +) -> Option<::aws_smithy_types::DateTime> { + 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, +) -> Option { + 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, +) -> ::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 {} + ), + } +} + +pub fn result_from_dafny( + 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)), + } +} + +pub fn result_to_dafny( + 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 diff --git a/TestModels/SimpleTypes/SimpleInteger/Makefile b/TestModels/SimpleTypes/SimpleInteger/Makefile index 7fd31ac8a..ad9561103 100644 --- a/TestModels/SimpleTypes/SimpleInteger/Makefile +++ b/TestModels/SimpleTypes/SimpleInteger/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../../SharedMakefile.mk NAMESPACE=simple.types.integer diff --git a/TestModels/SimpleTypes/SimpleInteger/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/SimpleTypes/SimpleInteger/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index 3b8e9f443..000000000 --- a/TestModels/SimpleTypes/SimpleInteger/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,1291 +0,0 @@ -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..a82eefe9 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client.rs -@@ -0,0 +1,39 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ pub fn from_conf( -+ conf: crate::types::simple_integer_config::SimpleIntegerConfig, -+ ) -> Result { -+ let inner = -+ crate::simple::types::integer::internaldafny::_default::SimpleInteger( -+ &crate::conversions::simple_integer_config::_simple_integer_config::to_dafny(conf), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+mod get_integer; -+ -+mod get_integer_known_value; -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer.rs -new file mode 100644 -index 00000000..ac241528 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer.rs -@@ -0,0 +1,13 @@ -+// 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::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)
-+ /// - On success, responds with [`GetIntegerOutput`](crate::operation::get_integer::GetIntegerOutput) with field(s): -+ /// - [`value(Option)`](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 b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer_known_value.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer_known_value.rs -new file mode 100644 -index 00000000..82695c20 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/client/get_integer_known_value.rs -@@ -0,0 +1,18 @@ -+// 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 b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..9d397cd0 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions.rs -@@ -0,0 +1,6 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_integer; -+ -+pub mod get_integer_known_value; -+ -+pub mod simple_integer_config; -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer.rs -new file mode 100644 -index 00000000..3637ac26 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer.rs -@@ -0,0 +1,32 @@ -+// 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::GetIntegerError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_integer::GetIntegerError::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::GetIntegerError { -+ // 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::GetIntegerError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_integer::GetIntegerError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_integer_input; -+ -+pub mod _get_integer_output; -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_input.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_input.rs -new file mode 100644 -index 00000000..9b5403e0 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_input.rs -@@ -0,0 +1,37 @@ -+// 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::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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_output.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_output.rs -new file mode 100644 -index 00000000..08831772 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer/_get_integer_output.rs -@@ -0,0 +1,37 @@ -+// 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::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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value.rs -new file mode 100644 -index 00000000..15c6b7c8 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value.rs -@@ -0,0 +1,32 @@ -+// 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 b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_input.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_input.rs -new file mode 100644 -index 00000000..40db6820 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_input.rs -@@ -0,0 +1,37 @@ -+// 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 b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_output.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_output.rs -new file mode 100644 -index 00000000..c122e6be ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/get_integer_known_value/_get_integer_known_value_output.rs -@@ -0,0 +1,37 @@ -+// 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 b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config.rs -new file mode 100644 -index 00000000..f3cdb738 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_integer_config; -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config/_simple_integer_config.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config/_simple_integer_config.rs -new file mode 100644 -index 00000000..360d1989 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/conversions/simple_integer_config/_simple_integer_config.rs -@@ -0,0 +1,19 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::types::simple_integer_config::SimpleIntegerConfig, -+) -> ::std::rc::Rc< -+ crate::simple::types::integer::internaldafny::types::SimpleIntegerConfig, -+> { -+ ::std::rc::Rc::new(crate::r#simple::types::integer::internaldafny::types::SimpleIntegerConfig::SimpleIntegerConfig {}) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::integer::internaldafny::types::SimpleIntegerConfig, -+ >, -+) -> crate::types::simple_integer_config::SimpleIntegerConfig { -+ crate::types::simple_integer_config::SimpleIntegerConfig {} -+} -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/implementation_from_dafny.rs -index 2cac6001..08623efb 100644 ---- b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,20 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+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_integer_config::SimpleIntegerConfig; -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/lib.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..e427bffa ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/lib.rs -@@ -0,0 +1,19 @@ -+#![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 b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..faaa994c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation.rs -@@ -0,0 +1,7 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetInteger` operation. -+pub mod get_integer; -+ -+/// Types for the `GetIntegerKnownValue` operation. -+pub mod get_integer_known_value; -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer.rs -new file mode 100644 -index 00000000..3cb49535 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer.rs -@@ -0,0 +1,145 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetInteger`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetInteger; -+impl GetInteger { -+ /// Creates a new `GetInteger` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_integer::GetIntegerInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_integer::GetIntegerOutput, -+ crate::operation::get_integer::GetIntegerError, -+ > { -+ let inner_input = crate::conversions::get_integer::_get_integer_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetInteger(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_integer::_get_integer_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_integer::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetInteger` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetIntegerError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetIntegerError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetIntegerError { -+ /// Creates the `GetIntegerError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetIntegerError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetIntegerError { -+ 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 GetIntegerError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetIntegerError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetIntegerError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetIntegerError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_integer::_get_integer_output::GetIntegerOutput; -+ -+pub use crate::operation::get_integer::_get_integer_input::GetIntegerInput; -+ -+mod _get_integer_input; -+ -+mod _get_integer_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_input.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_input.rs -new file mode 100644 -index 00000000..ab0c63e0 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_input.rs -@@ -0,0 +1,56 @@ -+// 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 GetIntegerInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option, -+} -+impl GetIntegerInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option<&i32> { -+ self.value.as_ref() -+ } -+} -+impl GetIntegerInput { -+ /// Creates a new builder-style object to manufacture [`GetIntegerInput`](crate::operation::operation::GetIntegerInput). -+ pub fn builder() -> crate::operation::get_integer::builders::GetIntegerInputBuilder { -+ crate::operation::get_integer::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, -+} -+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 -+ } -+ /// Consumes the builder and constructs a [`GetIntegerInput`](crate::operation::operation::GetIntegerInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_integer::GetIntegerInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_integer::GetIntegerInput { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_output.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_output.rs -new file mode 100644 -index 00000000..49ae58c8 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/_get_integer_output.rs -@@ -0,0 +1,62 @@ -+// 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 GetIntegerOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option, -+} -+ -+impl GetIntegerOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option { -+ 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 { -+ crate::operation::get_integer::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, -+} -+ -+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 -+ } -+ -+ /// Consumes the builder and constructs a [`GetIntegerOutput`](crate::operation::operation::GetIntegerOutput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_integer::GetIntegerOutput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_integer::GetIntegerOutput { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/builders.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/builders.rs -new file mode 100644 -index 00000000..74d985a9 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer/builders.rs -@@ -0,0 +1,72 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_integer::_get_integer_output::GetIntegerOutputBuilder; -+ -+pub use crate::operation::get_integer::_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::GetIntegerOutput, -+ crate::operation::get_integer::GetIntegerError, -+ > { -+ let mut fluent_builder = client.get_integer(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetInteger`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetIntegerFluentBuilder { -+ client: crate::Client, -+ inner: crate::operation::get_integer::builders::GetIntegerInputBuilder, -+} -+impl GetIntegerFluentBuilder { -+ /// Creates a new `GetInteger`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetInteger as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_integer::builders::GetIntegerInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_integer::GetIntegerOutput, -+ crate::operation::get_integer::GetIntegerError, -+ > { -+ 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::GetIntegerError::unhandled)?; -+ crate::operation::get_integer::GetInteger::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 b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value.rs -new file mode 100644 -index 00000000..06e0fa0c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value.rs -@@ -0,0 +1,150 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetIntegerKnownValue`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetIntegerKnownValue; -+impl GetIntegerKnownValue { -+ /// Creates a new `GetIntegerKnownValue` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_integer_known_value::GetIntegerKnownValueInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_integer_known_value::GetIntegerKnownValueOutput, -+ crate::operation::get_integer_known_value::GetIntegerKnownValueError, -+ > { -+ let inner_input = -+ crate::conversions::get_integer_known_value::_get_integer_known_value_input::to_dafny( -+ input, -+ ); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetInteger(&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( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err( -+ crate::conversions::get_integer_known_value::from_dafny_error( -+ inner_result.error().clone(), -+ ), -+ ) -+ } -+ } -+} -+ -+/// Error type for the `GetIntegerKnownValue` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetIntegerKnownValueError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetIntegerKnownValueError) 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. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetIntegerKnownValueError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetIntegerKnownValueError { -+ 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 { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetIntegerKnownValueError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetIntegerKnownValueError { -+ 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 { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_integer_known_value::_get_integer_known_value_output::GetIntegerKnownValueOutput; -+ -+pub use crate::operation::get_integer_known_value::_get_integer_known_value_input::GetIntegerKnownValueInput; -+ -+mod _get_integer_known_value_input; -+ -+mod _get_integer_known_value_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_input.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_input.rs -new file mode 100644 -index 00000000..83a4b829 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_input.rs -@@ -0,0 +1,59 @@ -+// 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 b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_output.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_output.rs -new file mode 100644 -index 00000000..f80e3163 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/_get_integer_known_value_output.rs -@@ -0,0 +1,60 @@ -+// 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 b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/builders.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/builders.rs -new file mode 100644 -index 00000000..9cfc99ee ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/operation/get_integer_known_value/builders.rs -@@ -0,0 +1,78 @@ -+// 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 b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..0ab75543 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `SimpleIntegerConfig` -+pub mod simple_integer_config; -diff --git b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types/simple_integer_config.rs a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types/simple_integer_config.rs -new file mode 100644 -index 00000000..15a5df47 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/types/simple_integer_config.rs -@@ -0,0 +1,48 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleIntegerConfig { -+ // XXX : ::std::option::Option -+} -+ -+impl SimpleIntegerConfig { -+ pub fn builder() -> SimpleIntegerConfigBuilder { -+ SimpleIntegerConfigBuilder::new() -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleIntegerConfigBuilder { -+ // XXX : ::std::option::Option -+} -+ -+impl SimpleIntegerConfigBuilder { -+ /// Creates a new `SimpleIntegerConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self { -+ // XXX = ::std::option::Option::None -+ // somewhere get default values for things? -+ } -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result -+ { -+ ::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/implementation_from_dafny.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/implementation_from_dafny.rs index 08623efb6..09475d19d 100644 --- a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/implementation_from_dafny.rs @@ -11,6 +11,10 @@ pub mod error; pub mod operation; mod conversions; +mod standard_library_conversions; + +#[cfg(feature = "wrapped-client")] +pub mod wrapped; pub use client::Client; pub use types::simple_integer_config::SimpleIntegerConfig; diff --git a/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/standard_library_conversions.rs new file mode 100644 index 000000000..2fec0ffb5 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleInteger/runtimes/rust/src/standard_library_conversions.rs @@ -0,0 +1,246 @@ +pub fn ostring_to_dafny( + input: &Option, +) -> ::std::rc::Rc< + 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 {}, +}; + ::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>>, + >, +) -> 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 + } +} + +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 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) +} + +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 + } +} + +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 blob_to_dafny( + input: &::aws_smithy_types::Blob, +) -> ::dafny_runtime::Sequence { + ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) +} + +pub fn oblob_to_dafny( + 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) +} + +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>>, +) -> Option<::aws_smithy_types::Blob> { + 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 odouble_to_dafny( + 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) +} + +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>>, +) -> Option { + 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, +) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { + ::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) +} + +pub fn timestamp_from_dafny( + 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() +} + +pub fn otimestamp_from_dafny( + input: ::std::rc::Rc>>, +) -> Option<::aws_smithy_types::DateTime> { + 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, +) -> Option { + 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, +) -> ::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 {} + ), + } +} + +pub fn result_from_dafny( + 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)), + } +} + +pub fn result_to_dafny( + 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 diff --git a/TestModels/SimpleTypes/SimpleLong/Makefile b/TestModels/SimpleTypes/SimpleLong/Makefile index 474038515..a897cbded 100644 --- a/TestModels/SimpleTypes/SimpleLong/Makefile +++ b/TestModels/SimpleTypes/SimpleLong/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../../SharedMakefile.mk NAMESPACE=simple.types.smithyLong diff --git a/TestModels/SimpleTypes/SimpleLong/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/SimpleTypes/SimpleLong/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index a015cf77a..000000000 --- a/TestModels/SimpleTypes/SimpleLong/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,1247 +0,0 @@ -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..0529ead1 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client.rs -@@ -0,0 +1,39 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ pub fn from_conf( -+ conf: crate::types::simple_long_config::SimpleLongConfig, -+ ) -> Result { -+ let inner = -+ crate::simple::types::smithylong::internaldafny::_default::SimpleLong( -+ &crate::conversions::simple_long_config::_simple_long_config::to_dafny(conf), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+mod get_long; -+ -+mod get_long_known_value; -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long.rs -new file mode 100644 -index 00000000..acd51ffb ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long.rs -@@ -0,0 +1,13 @@ -+// 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::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)
-+ /// - On success, responds with [`GetLongOutput`](crate::operation::get_long::GetLongOutput) with field(s): -+ /// - [`value(Option)`](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 b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long_known_value.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long_known_value.rs -new file mode 100644 -index 00000000..197e3f5b ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/client/get_long_known_value.rs -@@ -0,0 +1,17 @@ -+// 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 b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..4ff5bcbc ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions.rs -@@ -0,0 +1,6 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_long; -+ -+pub mod get_long_known_value; -+ -+pub mod simple_long_config; -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long.rs -new file mode 100644 -index 00000000..59558ca1 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long.rs -@@ -0,0 +1,32 @@ -+// 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::GetLongError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_long::GetLongError::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::GetLongError { -+ // 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::GetLongError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_long::GetLongError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_long_input; -+ -+pub mod _get_long_output; -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_input.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_input.rs -new file mode 100644 -index 00000000..83929597 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_input.rs -@@ -0,0 +1,37 @@ -+// 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::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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_output.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_output.rs -new file mode 100644 -index 00000000..68ff34de ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long/_get_long_output.rs -@@ -0,0 +1,37 @@ -+// 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::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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value.rs -new file mode 100644 -index 00000000..f4c90a3a ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value.rs -@@ -0,0 +1,32 @@ -+// 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 b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_input.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_input.rs -new file mode 100644 -index 00000000..aae39905 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_input.rs -@@ -0,0 +1,37 @@ -+// 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 b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_output.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_output.rs -new file mode 100644 -index 00000000..bdc927aa ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/get_long_known_value/_get_long_known_value_output.rs -@@ -0,0 +1,37 @@ -+// 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 b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config.rs -new file mode 100644 -index 00000000..129c7eb4 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_long_config; -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config/_simple_long_config.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config/_simple_long_config.rs -new file mode 100644 -index 00000000..4bb610c4 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/conversions/simple_long_config/_simple_long_config.rs -@@ -0,0 +1,19 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::types::simple_long_config::SimpleLongConfig, -+) -> ::std::rc::Rc< -+ crate::simple::types::smithylong::internaldafny::types::SimpleLongConfig, -+> { -+ ::std::rc::Rc::new(crate::r#simple::types::smithylong::internaldafny::types::SimpleLongConfig::SimpleLongConfig {}) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::smithylong::internaldafny::types::SimpleLongConfig, -+ >, -+) -> crate::types::simple_long_config::SimpleLongConfig { -+ crate::types::simple_long_config::SimpleLongConfig {} -+} -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/implementation_from_dafny.rs -index 383ec2da..dfb4f9de 100644 ---- b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,20 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+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_long_config::SimpleLongConfig; -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/lib.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..1248f583 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/lib.rs -@@ -0,0 +1,19 @@ -+#![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 b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..93787200 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation.rs -@@ -0,0 +1,7 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetLong` operation. -+pub mod get_long; -+ -+/// Types for the `GetLongKnownValue` operation. -+pub mod get_long_known_value; -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long.rs -new file mode 100644 -index 00000000..44259e5b ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long.rs -@@ -0,0 +1,142 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetLong`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetLong; -+impl GetLong { -+ /// Creates a new `GetLong` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_long::GetLongInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_long::GetLongOutput, -+ 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); -+ 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(), -+ )) -+ } else { -+ Err(crate::conversions::get_long::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetLong` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetLongError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetLongError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetLongError { -+ /// Creates the `GetLongError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetLongError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetLongError { -+ 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 GetLongError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetLongError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetLongError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetLongError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_long::_get_long_output::GetLongOutput; -+ -+pub use crate::operation::get_long::_get_long_input::GetLongInput; -+ -+mod _get_long_input; -+ -+mod _get_long_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_input.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_input.rs -new file mode 100644 -index 00000000..cf4ca97a ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_input.rs -@@ -0,0 +1,54 @@ -+// 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 GetLongInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option, -+} -+impl GetLongInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option<&i64> { -+ self.value.as_ref() -+ } -+} -+impl GetLongInput { -+ /// Creates a new builder-style object to manufacture [`GetLongInput`](crate::operation::operation::GetLongInput). -+ pub fn builder() -> crate::operation::get_long::builders::GetLongInputBuilder { -+ crate::operation::get_long::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, -+} -+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 -+ } -+ /// Consumes the builder and constructs a [`GetLongInput`](crate::operation::operation::GetLongInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_long::GetLongInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_long::GetLongInput { value: self.value }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_output.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_output.rs -new file mode 100644 -index 00000000..5a2814c6 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/_get_long_output.rs -@@ -0,0 +1,60 @@ -+// 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 GetLongOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option, -+} -+ -+impl GetLongOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option { -+ 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 { -+ crate::operation::get_long::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, -+} -+ -+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 -+ } -+ -+ /// Consumes the builder and constructs a [`GetLongOutput`](crate::operation::operation::GetLongOutput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_long::GetLongOutput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_long::GetLongOutput { value: self.value }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/builders.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/builders.rs -new file mode 100644 -index 00000000..cf89d6b3 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long/builders.rs -@@ -0,0 +1,72 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_long::_get_long_output::GetLongOutputBuilder; -+ -+pub use crate::operation::get_long::_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::GetLongOutput, -+ crate::operation::get_long::GetLongError, -+ > { -+ let mut fluent_builder = client.get_long(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetLong`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetLongFluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::get_long::builders::GetLongInputBuilder, -+} -+impl GetLongFluentBuilder { -+ /// Creates a new `GetLong`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetLong as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_long::builders::GetLongInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_long::GetLongOutput, -+ crate::operation::get_long::GetLongError, -+ > { -+ 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::GetLongError::unhandled)?; -+ crate::operation::get_long::GetLong::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 b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value.rs -new file mode 100644 -index 00000000..b434182d ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value.rs -@@ -0,0 +1,145 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetLongKnownValue`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetLongKnownValue; -+impl GetLongKnownValue { -+ /// Creates a new `GetLongKnownValue` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_long_known_value::GetLongKnownValueInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_long_known_value::GetLongKnownValueOutput, -+ crate::operation::get_long_known_value::GetLongKnownValueError, -+ > { -+ 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); -+ 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( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_long_known_value::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetLongKnownValue` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetLongKnownValueError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetLongKnownValueError) 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. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetLongKnownValueError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetLongKnownValueError { -+ 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 { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetLongKnownValueError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetLongKnownValueError { -+ 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 { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_long_known_value::_get_long_known_value_output::GetLongKnownValueOutput; -+ -+pub use crate::operation::get_long_known_value::_get_long_known_value_input::GetLongKnownValueInput; -+ -+mod _get_long_known_value_input; -+ -+mod _get_long_known_value_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_input.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_input.rs -new file mode 100644 -index 00000000..b1b4d3be ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_input.rs -@@ -0,0 +1,57 @@ -+// 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 b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_output.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_output.rs -new file mode 100644 -index 00000000..b18b9c89 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/_get_long_known_value_output.rs -@@ -0,0 +1,57 @@ -+// 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 b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/builders.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/builders.rs -new file mode 100644 -index 00000000..46a4de5e ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/operation/get_long_known_value/builders.rs -@@ -0,0 +1,74 @@ -+// 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 b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..f8ff6d66 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `SimpleLongConfig` -+pub mod simple_long_config; -diff --git b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types/simple_long_config.rs a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types/simple_long_config.rs -new file mode 100644 -index 00000000..7def54c0 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/types/simple_long_config.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleLongConfig {} -+ -+impl SimpleLongConfig { -+ pub fn builder() -> SimpleLongConfigBuilder { -+ SimpleLongConfigBuilder::new() -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleLongConfigBuilder {} -+ -+impl SimpleLongConfigBuilder { -+ /// Creates a new `SimpleLongConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self {} -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result -+ { -+ ::std::result::Result::Ok(SimpleLongConfig {}) -+ } -+} diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/implementation_from_dafny.rs index dfb4f9de0..f9ec87558 100644 --- a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/implementation_from_dafny.rs @@ -11,6 +11,10 @@ pub mod error; pub mod operation; mod conversions; +mod standard_library_conversions; + +#[cfg(feature = "wrapped-client")] +pub mod wrapped; pub use client::Client; pub use types::simple_long_config::SimpleLongConfig; diff --git a/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/standard_library_conversions.rs new file mode 100644 index 000000000..2fec0ffb5 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleLong/runtimes/rust/src/standard_library_conversions.rs @@ -0,0 +1,246 @@ +pub fn ostring_to_dafny( + input: &Option, +) -> ::std::rc::Rc< + 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 {}, +}; + ::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>>, + >, +) -> 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 + } +} + +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 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) +} + +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 + } +} + +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 blob_to_dafny( + input: &::aws_smithy_types::Blob, +) -> ::dafny_runtime::Sequence { + ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) +} + +pub fn oblob_to_dafny( + 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) +} + +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>>, +) -> Option<::aws_smithy_types::Blob> { + 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 odouble_to_dafny( + 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) +} + +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>>, +) -> Option { + 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, +) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { + ::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) +} + +pub fn timestamp_from_dafny( + 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() +} + +pub fn otimestamp_from_dafny( + input: ::std::rc::Rc>>, +) -> Option<::aws_smithy_types::DateTime> { + 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, +) -> Option { + 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, +) -> ::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 {} + ), + } +} + +pub fn result_from_dafny( + 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)), + } +} + +pub fn result_to_dafny( + 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 diff --git a/TestModels/SimpleTypes/SimpleShort/Makefile b/TestModels/SimpleTypes/SimpleShort/Makefile index 794dc6d8a..712e8c8ae 100644 --- a/TestModels/SimpleTypes/SimpleShort/Makefile +++ b/TestModels/SimpleTypes/SimpleShort/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../../SharedMakefile.mk NAMESPACE=simple.types.short diff --git a/TestModels/SimpleTypes/SimpleString/Makefile b/TestModels/SimpleTypes/SimpleString/Makefile index 6db609ced..9e7245723 100644 --- a/TestModels/SimpleTypes/SimpleString/Makefile +++ b/TestModels/SimpleTypes/SimpleString/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../../SharedMakefile.mk NAMESPACE=simple.types.smithyString diff --git a/TestModels/SimpleTypes/SimpleString/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/SimpleTypes/SimpleString/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index 346bd03b1..000000000 --- a/TestModels/SimpleTypes/SimpleString/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,1822 +0,0 @@ -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..fc54e838 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client.rs -@@ -0,0 +1,43 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ 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), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+mod get_string; -+ -+mod get_string_known_value; -+ -+mod get_string_utf8; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string.rs -new file mode 100644 -index 00000000..da262534 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string.rs -@@ -0,0 +1,13 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+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)
-+ /// - On success, responds with [`GetStringOutput`](crate::operation::get_string::GetStringOutput) with field(s): -+ /// - [`value(Option)`](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 b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_known_value.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_known_value.rs -new file mode 100644 -index 00000000..8c13c6ad ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_known_value.rs -@@ -0,0 +1,17 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+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) -+ /// - 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(), -+ ) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_single_value.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_single_value.rs -new file mode 100644 -index 00000000..6ce27235 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_single_value.rs -@@ -0,0 +1,17 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+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) -+ /// - 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.handle.clone(), -+ ) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_utf8.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_utf8.rs -new file mode 100644 -index 00000000..3a487be0 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/client/get_string_utf8.rs -@@ -0,0 +1,15 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+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)
-+ /// - On success, responds with [`GetStringUTF8Output`](crate::operation::get_string_utf8::GetStringUTF8Output) with field(s): -+ /// - [`value(Option)`](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 { -+ crate::operation::get_string_utf8::builders::GetStringUTF8FluentBuilder::new(self.clone()) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..0c2b4cf1 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions.rs -@@ -0,0 +1,8 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_string; -+ -+pub mod get_string_known_value; -+ -+pub mod get_string_utf8; -+ -+pub mod simple_string_config; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string.rs -new file mode 100644 -index 00000000..4a11ce93 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string.rs -@@ -0,0 +1,33 @@ -+// 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_string::GetStringError, -+) -> ::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)) }) -+ } -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny_error( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::smithystring::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_string::GetStringError { -+ // 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::smithystring::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_string::GetStringError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_string::GetStringError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_string_input; -+ -+pub mod _get_string_output; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_input.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_input.rs -new file mode 100644 -index 00000000..2b7ac1e6 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_input.rs -@@ -0,0 +1,43 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_output.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_output.rs -new file mode 100644 -index 00000000..66cfd606 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string/_get_string_output.rs -@@ -0,0 +1,41 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[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) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc, -+) -> 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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value.rs -new file mode 100644 -index 00000000..680fd6ad ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value.rs -@@ -0,0 +1,33 @@ -+// 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_string_known_value::GetStringKnownValueError, -+) -> ::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)) }) -+ } -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny_error( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::smithystring::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_string_known_value::GetStringKnownValueError { -+ // 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::smithystring::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_string_known_value::GetStringKnownValueError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_string_known_value::GetStringKnownValueError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_string_known_value_input; -+ -+pub mod _get_string_known_value_output; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_input.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_input.rs -new file mode 100644 -index 00000000..2a638911 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_input.rs -@@ -0,0 +1,43 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_string_known_value::GetStringKnownValueInput, -+) -> ::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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_output.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_output.rs -new file mode 100644 -index 00000000..00f53c20 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_known_value/_get_string_known_value_output.rs -@@ -0,0 +1,41 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_string_known_value::GetStringKnownValueOutput, -+) -> ::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) -+ }) -+} -+ -+#[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 } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8.rs -new file mode 100644 -index 00000000..1f3d581e ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8.rs -@@ -0,0 +1,33 @@ -+// 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_string_utf8::GetStringUTF8Error, -+) -> ::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)) }) -+ } -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny_error( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::smithystring::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_string_utf8::GetStringUTF8Error { -+ // 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::smithystring::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_string_utf8::GetStringUTF8Error::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_string_utf8::GetStringUTF8Error::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_string_utf8_input; -+ -+pub mod _get_string_utf8_output; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_input.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_input.rs -new file mode 100644 -index 00000000..52a7039e ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_input.rs -@@ -0,0 +1,43 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_string_utf8::GetStringUTF8Input, -+) -> ::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) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::smithystring::internaldafny::types::GetStringInput, -+ >, -+) -> crate::operation::get_string_utf8::GetStringUTF8Input { -+ 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_utf8::GetStringUTF8Input { value } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_output.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_output.rs -new file mode 100644 -index 00000000..a07f35ea ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/get_string_utf8/_get_string_utf8_output.rs -@@ -0,0 +1,41 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[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) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc, -+) -> crate::operation::get_string_utf8::GetStringUTF8Output { -+ 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_utf8::GetStringUTF8Output { value } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config.rs -new file mode 100644 -index 00000000..286313ae ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_string_config; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config/_simple_string_config.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config/_simple_string_config.rs -new file mode 100644 -index 00000000..95d7da8d ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/conversions/simple_string_config/_simple_string_config.rs -@@ -0,0 +1,19 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::types::simple_string_config::SimpleStringConfig, -+) -> ::std::rc::Rc< -+ crate::simple::types::smithystring::internaldafny::types::SimpleStringConfig, -+> { -+ ::std::rc::Rc::new(crate::r#simple::types::smithystring::internaldafny::types::SimpleStringConfig::SimpleStringConfig {}) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::smithystring::internaldafny::types::SimpleStringConfig, -+ >, -+) -> crate::types::simple_string_config::SimpleStringConfig { -+ crate::types::simple_string_config::SimpleStringConfig {} -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/implementation_from_dafny.rs -index 2f103858..25eb73a1 100644 ---- b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,21 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+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; -+ -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/lib.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..4315dacf ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/lib.rs -@@ -0,0 +1,17 @@ -+#![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 b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..af6d5f9c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation.rs -@@ -0,0 +1,10 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetString` operation. -+pub mod get_string; -+ -+/// Types for the `GetStringKnownValue` operation. -+pub mod get_string_known_value; -+ -+/// Types for the `GetStringUTF8` operation. -+pub mod get_string_utf8; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string.rs -new file mode 100644 -index 00000000..813f2280 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string.rs -@@ -0,0 +1,145 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetString`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetString; -+impl GetString { -+ /// Creates a new `GetString` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_string::GetStringInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_string::GetStringOutput, -+ crate::operation::get_string::GetStringError, -+ > { -+ let inner_input = crate::conversions::get_string::_get_string_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetString(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_string::_get_string_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_string::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetString` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetStringError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetStringError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetStringError { -+ /// Creates the `GetStringError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetStringError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetStringError { -+ 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 GetStringError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetStringError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetStringError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetStringError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_string::_get_string_output::GetStringOutput; -+ -+pub use crate::operation::get_string::_get_string_input::GetStringInput; -+ -+mod _get_string_input; -+ -+mod _get_string_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_input.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_input.rs -new file mode 100644 -index 00000000..9c0d47f5 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_input.rs -@@ -0,0 +1,56 @@ -+// 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 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<&str> { -+ self.value.as_deref() -+ } -+} -+impl GetStringInput { -+ /// Creates a new builder-style object to manufacture [`GetStringInput`](crate::operation::operation::GetStringInput). -+ pub fn builder() -> crate::operation::get_string::builders::GetStringInputBuilder { -+ crate::operation::get_string::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::GetStringInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_string::GetStringInput { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_output.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_output.rs -new file mode 100644 -index 00000000..ab6b1fa3 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/_get_string_output.rs -@@ -0,0 +1,56 @@ -+// 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 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<&str> { -+ self.value.as_deref() -+ } -+} -+impl GetStringOutput { -+ /// Creates a new builder-style object to manufacture [`GetStringOutput`](crate::operation::operation::GetStringOutput). -+ pub fn builder() -> crate::operation::get_string::builders::GetStringOutputBuilder { -+ crate::operation::get_string::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::GetStringOutput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_string::GetStringOutput { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/builders.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/builders.rs -new file mode 100644 -index 00000000..ec32b2e2 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string/builders.rs -@@ -0,0 +1,72 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_string::_get_string_output::GetStringOutputBuilder; -+ -+pub use crate::operation::get_string::_get_string_input::GetStringInputBuilder; -+ -+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::GetStringOutput, -+ crate::operation::get_string::GetStringError, -+ > { -+ let mut fluent_builder = client.get_string(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetString`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetStringFluentBuilder { -+ client: crate::Client, -+ inner: crate::operation::get_string::builders::GetStringInputBuilder, -+} -+impl GetStringFluentBuilder { -+ /// Creates a new `GetString`. -+ pub(crate) fn new(client: crate::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetString as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_string::builders::GetStringInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_string::GetStringOutput, -+ crate::operation::get_string::GetStringError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetString 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::GetStringError::unhandled)?; -+ crate::operation::get_string::GetString::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() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value.rs -new file mode 100644 -index 00000000..bae4c3d9 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value.rs -@@ -0,0 +1,146 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetStringKnownValue`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetStringKnownValue; -+impl GetStringKnownValue { -+ /// Creates a new `GetStringKnownValue` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_string_known_value::GetStringKnownValueInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_string_known_value::GetStringKnownValueOutput, -+ 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_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetStringUTF8(&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(), -+ ), -+ ) -+ } -+ } -+} -+ -+/// Error type for the `GetStringKnownValue` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetStringKnownValueError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetStringKnownValueError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetStringKnownValueError { -+ /// Creates the `GetStringKnownValueError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetStringKnownValueError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetStringKnownValueError { -+ 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 GetStringKnownValueError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetStringKnownValueError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetStringKnownValueError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetStringKnownValueError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_string_known_value::_get_string_known_value_output::GetStringKnownValueOutput; -+ -+pub use crate::operation::get_string_known_value::_get_string_known_value_input::GetStringKnownValueInput; -+ -+mod _get_string_known_value_input; -+ -+mod _get_string_known_value_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_input.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_input.rs -new file mode 100644 -index 00000000..b67c3eff ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_input.rs -@@ -0,0 +1,60 @@ -+// 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 b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_output.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_output.rs -new file mode 100644 -index 00000000..291e692c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/_get_string_known_value_output.rs -@@ -0,0 +1,59 @@ -+// 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 b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/builders.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/builders.rs -new file mode 100644 -index 00000000..82b4c7fb ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_known_value/builders.rs -@@ -0,0 +1,77 @@ -+// 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; -+ -+pub use crate::operation::get_string_known_value::_get_string_known_value_input::GetStringKnownValueInputBuilder; -+ -+impl GetStringKnownValueInputBuilder { -+ /// 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::GetStringKnownValueError, -+ > { -+ let mut fluent_builder = client.get_string_known_value(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetStringKnownValue`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetStringKnownValueFluentBuilder { -+ client: crate::Client, -+ inner: crate::operation::get_string_known_value::builders::GetStringKnownValueInputBuilder, -+} -+impl GetStringKnownValueFluentBuilder { -+ /// Creates a new `GetStringKnownValue`. -+ pub(crate) fn new(client: crate::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 { -+ &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::GetStringKnownValueError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetString 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 -+ } -+ -+ #[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() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8.rs -new file mode 100644 -index 00000000..966f2152 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8.rs -@@ -0,0 +1,146 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetStringUTF8`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetStringUTF8; -+impl GetStringUTF8 { -+ /// Creates a new `GetStringUTF8` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_string_utf8::GetStringUTF8Input, -+ ) -> ::std::result::Result< -+ 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_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetStringUTF8(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_string_utf8::_get_string_utf8_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_string_utf8::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetStringUTF8` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetStringUTF8Error { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetStringUTF8Error) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetStringUTF8Error { -+ /// Creates the `GetStringUTF8Error::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetStringUTF8Error::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetStringUTF8Error { -+ 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 GetStringUTF8Error { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetStringUTF8Error { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetStringUTF8Error { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetStringUTF8Error { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_string_utf8::_get_string_utf8_output::GetStringUTF8Output; -+ -+pub use crate::operation::get_string_utf8::_get_string_utf8_input::GetStringUTF8Input; -+ -+mod _get_string_utf8_input; -+ -+mod _get_string_utf8_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_input.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_input.rs -new file mode 100644 -index 00000000..a448688e ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_input.rs -@@ -0,0 +1,56 @@ -+// 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 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<&str> { -+ self.value.as_deref() -+ } -+} -+impl GetStringUTF8Input { -+ /// Creates a new builder-style object to manufacture [`GetStringUTF8Input`](crate::operation::operation::GetStringUTF8Input). -+ pub fn builder() -> crate::operation::get_string_utf8::builders::GetStringUTF8InputBuilder { -+ crate::operation::get_string_utf8::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::GetStringUTF8Input, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_string_utf8::GetStringUTF8Input { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_output.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_output.rs -new file mode 100644 -index 00000000..2c8dca6a ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/_get_string_utf8_output.rs -@@ -0,0 +1,56 @@ -+// 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 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<&str> { -+ self.value.as_deref() -+ } -+} -+impl GetStringUTF8Output { -+ /// Creates a new builder-style object to manufacture [`GetStringUTF8Output`](crate::operation::operation::GetStringUTF8Output). -+ pub fn builder() -> crate::operation::get_string_utf8::builders::GetStringUTF8OutputBuilder { -+ crate::operation::get_string_utf8::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::GetStringUTF8Output, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_string_utf8::GetStringUTF8Output { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/builders.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/builders.rs -new file mode 100644 -index 00000000..26bf3d9e ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/operation/get_string_utf8/builders.rs -@@ -0,0 +1,74 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_string_utf8::_get_string_utf8_output::GetStringUTF8OutputBuilder; -+ -+pub use crate::operation::get_string_utf8::_get_string_utf8_input::GetStringUTF8InputBuilder; -+ -+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::GetStringUTF8Output, -+ crate::operation::get_string_utf8::GetStringUTF8Error, -+ > { -+ let mut fluent_builder = client.get_string_utf8(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetStringUTF8`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetStringUTF8FluentBuilder { -+ client: crate::Client, -+ inner: crate::operation::get_string_utf8::builders::GetStringUTF8InputBuilder, -+} -+impl GetStringUTF8FluentBuilder { -+ /// Creates a new `GetStringUTF8`. -+ pub(crate) fn new(client: crate::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 { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_string_utf8::GetStringUTF8Output, -+ crate::operation::get_string_utf8::GetStringUTF8Error, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetString 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_utf8::GetStringUTF8Error::unhandled)?; -+ crate::operation::get_string_utf8::GetStringUTF8::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() -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..7ec74609 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `SimpleStringConfig` -+pub mod simple_string_config; -diff --git b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types/simple_string_config.rs a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types/simple_string_config.rs -new file mode 100644 -index 00000000..6b9ec61a ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/types/simple_string_config.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleStringConfig {} -+ -+impl SimpleStringConfig { -+ pub fn builder() -> SimpleStringConfigBuilder { -+ SimpleStringConfigBuilder::new() -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleStringConfigBuilder {} -+ -+impl SimpleStringConfigBuilder { -+ /// Creates a new `SimpleStringConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self {} -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result -+ { -+ ::std::result::Result::Ok(SimpleStringConfig {}) -+ } -+} diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/implementation_from_dafny.rs index 25eb73a19..1f9df0eef 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/implementation_from_dafny.rs @@ -11,11 +11,14 @@ pub mod error; pub mod operation; mod conversions; +mod standard_library_conversions; + +#[cfg(feature = "wrapped-client")] +pub mod wrapped; pub use client::Client; pub use types::simple_string_config::SimpleStringConfig; - pub mod r#_Wrappers_Compile { pub use dafny_runtime::DafnyPrint; pub use std::cmp::Eq; diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/standard_library_conversions.rs new file mode 100644 index 000000000..2fec0ffb5 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/src/standard_library_conversions.rs @@ -0,0 +1,246 @@ +pub fn ostring_to_dafny( + input: &Option, +) -> ::std::rc::Rc< + 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 {}, +}; + ::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>>, + >, +) -> 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 + } +} + +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 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) +} + +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 + } +} + +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 blob_to_dafny( + input: &::aws_smithy_types::Blob, +) -> ::dafny_runtime::Sequence { + ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) +} + +pub fn oblob_to_dafny( + 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) +} + +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>>, +) -> Option<::aws_smithy_types::Blob> { + 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 odouble_to_dafny( + 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) +} + +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>>, +) -> Option { + 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, +) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { + ::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) +} + +pub fn timestamp_from_dafny( + 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() +} + +pub fn otimestamp_from_dafny( + input: ::std::rc::Rc>>, +) -> Option<::aws_smithy_types::DateTime> { + 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, +) -> Option { + 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, +) -> ::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 {} + ), + } +} + +pub fn result_from_dafny( + 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)), + } +} + +pub fn result_to_dafny( + 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 diff --git a/TestModels/SimpleTypes/SimpleTimestamp/Makefile b/TestModels/SimpleTypes/SimpleTimestamp/Makefile index a8263c021..b49b5ab80 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/Makefile +++ b/TestModels/SimpleTypes/SimpleTimestamp/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../../SharedMakefile.mk NAMESPACE=simple.types.timestamp diff --git a/TestModels/SimpleTypes/SimpleTimestamp/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/SimpleTypes/SimpleTimestamp/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index 814de41f4..000000000 --- a/TestModels/SimpleTypes/SimpleTimestamp/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,737 +0,0 @@ -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..1691812f ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client.rs -@@ -0,0 +1,37 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ pub fn from_conf( -+ conf: crate::types::simple_timestamp_config::SimpleTimestampConfig, -+ ) -> Result { -+ let inner = -+ crate::simple::types::timestamp::internaldafny::_default::SimpleTimestamp( -+ &crate::conversions::simple_timestamp_config::_simple_timestamp_config::to_dafny(conf), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+mod get_timestamp; -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client/get_timestamp.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client/get_timestamp.rs -new file mode 100644 -index 00000000..9004f4f3 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/client/get_timestamp.rs -@@ -0,0 +1,15 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+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)
-+ /// - On success, responds with [`GetTimestampOutput`](crate::operation::get_timestamp::GetTimestampOutput) with field(s): -+ /// - [`value(Option)`](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 { -+ crate::operation::get_timestamp::builders::GetTimestampFluentBuilder::new(self.clone()) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..6c19c684 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_timestamp; -+ -+pub mod simple_timestamp_config; -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp.rs -new file mode 100644 -index 00000000..64d9cf3a ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp.rs -@@ -0,0 +1,33 @@ -+// 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_timestamp::GetTimestampError, -+) -> ::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)) }) -+ } -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny_error( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::timestamp::internaldafny::types::Error, -+ >, -+) -> crate::operation::get_timestamp::GetTimestampError { -+ // 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::timestamp::internaldafny::types::Error::CollectionOfErrors { .. }) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_timestamp::GetTimestampError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message(error_message).build()) -+ } else { -+ crate::operation::get_timestamp::GetTimestampError::generic(::aws_smithy_types::error::metadata::ErrorMetadata::builder().message("Opaque error").build()) -+ } -+} -+ -+pub mod _get_timestamp_input; -+ -+pub mod _get_timestamp_output; -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_input.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_input.rs -new file mode 100644 -index 00000000..ec1fde89 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_input.rs -@@ -0,0 +1,39 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[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) -+ }) -+} -+ -+#[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 }) -+} -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_output.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_output.rs -new file mode 100644 -index 00000000..958069da ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/get_timestamp/_get_timestamp_output.rs -@@ -0,0 +1,39 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[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) -+ }) -+} -+ -+#[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 }) -+} -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config.rs -new file mode 100644 -index 00000000..3ab14490 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_timestamp_config; -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config/_simple_timestamp_config.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config/_simple_timestamp_config.rs -new file mode 100644 -index 00000000..7a6ad17f ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/conversions/simple_timestamp_config/_simple_timestamp_config.rs -@@ -0,0 +1,19 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::types::simple_timestamp_config::SimpleTimestampConfig, -+) -> ::std::rc::Rc< -+ crate::simple::types::timestamp::internaldafny::types::SimpleTimestampConfig, -+>{ -+ ::std::rc::Rc::new(crate::r#simple::types::timestamp::internaldafny::types::SimpleTimestampConfig::SimpleTimestampConfig {}) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::types::timestamp::internaldafny::types::SimpleTimestampConfig, -+ >, -+) -> crate::types::simple_timestamp_config::SimpleTimestampConfig { -+ crate::types::simple_timestamp_config::SimpleTimestampConfig {} -+} -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/implementation_from_dafny.rs -index 61147902..f16e01c9 100644 ---- b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,21 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+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_timestamp_config::SimpleTimestampConfig; -+ -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/lib.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..4e55b724 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/lib.rs -@@ -0,0 +1,19 @@ -+#![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 b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..14ae6ca5 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetTimestamp` operation. -+pub mod get_timestamp; -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp.rs -new file mode 100644 -index 00000000..27f406c7 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp.rs -@@ -0,0 +1,144 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetTimestamp`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetTimestamp; -+impl GetTimestamp { -+ /// Creates a new `GetTimestamp` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_timestamp::GetTimestampInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_timestamp::GetTimestampOutput, -+ crate::operation::get_timestamp::GetTimestampError, -+ > { -+ let inner_input = crate::conversions::get_timestamp::_get_timestamp_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetTimestamp(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ 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(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetTimestamp` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetTimestampError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetTimestampError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetTimestampError { -+ /// Creates the `GetTimestampError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetTimestampError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetTimestampError { -+ 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 GetTimestampError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetTimestampError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetTimestampError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetTimestampError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_timestamp::_get_timestamp_output::GetTimestampOutput; -+ -+pub use crate::operation::get_timestamp::_get_timestamp_input::GetTimestampInput; -+ -+mod _get_timestamp_input; -+ -+mod _get_timestamp_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_input.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_input.rs -new file mode 100644 -index 00000000..acf259d3 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_input.rs -@@ -0,0 +1,56 @@ -+// 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 GetTimestampInput { -+ #[allow(missing_docs)] // documentation missing in model -+ 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() -+ } -+} -+impl GetTimestampInput { -+ /// Creates a new builder-style object to manufacture [`GetTimestampInput`](crate::operation::get_timestamp::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). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetTimestampInputBuilder { -+ pub(crate) value: ::std::option::Option<::aws_smithy_types::DateTime>, -+} -+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 build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_timestamp::GetTimestampInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_timestamp::GetTimestampInput { -+ value: self.value, -+ }) -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_output.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_output.rs -new file mode 100644 -index 00000000..711324b3 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/_get_timestamp_output.rs -@@ -0,0 +1,49 @@ -+// 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 GetTimestampOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ 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() -+ } -+} -+impl GetTimestampOutput { -+ /// Creates a new builder-style object to manufacture [`GetTimestampOutput`](crate::operation::get_timestamp::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). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetTimestampOutputBuilder { -+ pub(crate) value: ::std::option::Option<::aws_smithy_types::DateTime>, -+} -+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 } -+ } -+} -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/builders.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/builders.rs -new file mode 100644 -index 00000000..6097f5dc ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/operation/get_timestamp/builders.rs -@@ -0,0 +1,72 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_timestamp::_get_timestamp_output::GetTimestampOutputBuilder; -+ -+pub use crate::operation::get_timestamp::_get_timestamp_input::GetTimestampInputBuilder; -+ -+impl GetTimestampInputBuilder { -+ /// 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_timestamp::GetTimestampOutput, -+ crate::operation::get_timestamp::GetTimestampError, -+ > { -+ let mut fluent_builder = client.get_timestamp(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetTimestamp`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetTimestampFluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::get_timestamp::builders::GetTimestampInputBuilder, -+} -+impl GetTimestampFluentBuilder { -+ /// Creates a new `GetTimestamp`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetTimestamp as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_timestamp::builders::GetTimestampInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_timestamp::GetTimestampOutput, -+ crate::operation::get_timestamp::GetTimestampError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetTimestamp 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_timestamp::GetTimestampError::unhandled)?; -+ crate::operation::get_timestamp::GetTimestamp::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::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 b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..b22d67cc ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types.rs -@@ -0,0 +1,4 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `SimpleTimestampConfig` -+pub mod simple_timestamp_config; -diff --git b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types/simple_timestamp_config.rs a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types/simple_timestamp_config.rs -new file mode 100644 -index 00000000..611191c9 ---- /dev/null -+++ a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/types/simple_timestamp_config.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleTimestampConfig {} -+ -+impl SimpleTimestampConfig { -+ pub fn builder() -> SimpleTimestampConfigBuilder { -+ SimpleTimestampConfigBuilder::new() -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleTimestampConfigBuilder {} -+ -+impl SimpleTimestampConfigBuilder { -+ /// Creates a new `SimpleTimestampConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self {} -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result -+ { -+ ::std::result::Result::Ok(SimpleTimestampConfig {}) -+ } -+} diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/implementation_from_dafny.rs index f16e01c9a..8d709cb22 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/implementation_from_dafny.rs @@ -11,11 +11,14 @@ pub mod error; pub mod operation; mod conversions; +mod standard_library_conversions; + +#[cfg(feature = "wrapped-client")] +pub mod wrapped; pub use client::Client; pub use types::simple_timestamp_config::SimpleTimestampConfig; - pub mod r#_Wrappers_Compile { pub use dafny_runtime::DafnyPrint; pub use std::cmp::Eq; diff --git a/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/standard_library_conversions.rs b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/standard_library_conversions.rs new file mode 100644 index 000000000..2fec0ffb5 --- /dev/null +++ b/TestModels/SimpleTypes/SimpleTimestamp/runtimes/rust/src/standard_library_conversions.rs @@ -0,0 +1,246 @@ +pub fn ostring_to_dafny( + input: &Option, +) -> ::std::rc::Rc< + 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 {}, +}; + ::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>>, + >, +) -> 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 + } +} + +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 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) +} + +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 + } +} + +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 blob_to_dafny( + input: &::aws_smithy_types::Blob, +) -> ::dafny_runtime::Sequence { + ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) +} + +pub fn oblob_to_dafny( + 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) +} + +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>>, +) -> Option<::aws_smithy_types::Blob> { + 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 odouble_to_dafny( + 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) +} + +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>>, +) -> Option { + 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, +) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { + ::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) +} + +pub fn timestamp_from_dafny( + 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() +} + +pub fn otimestamp_from_dafny( + input: ::std::rc::Rc>>, +) -> Option<::aws_smithy_types::DateTime> { + 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, +) -> Option { + 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, +) -> ::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 {} + ), + } +} + +pub fn result_from_dafny( + 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)), + } +} + +pub fn result_to_dafny( + 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 diff --git a/TestModels/SimpleTypes/SimpleTimestamp/src/Index.dfy b/TestModels/SimpleTypes/SimpleTimestamp/src/Index.dfy new file mode 100644 index 000000000..f5065f96a --- /dev/null +++ b/TestModels/SimpleTypes/SimpleTimestamp/src/Index.dfy @@ -0,0 +1,31 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +include "SimpleTimestampImpl.dfy" + +module {:extern "simple.types.timestamp.internaldafny" } SimpleTimestamp refines AbstractSimpleTypesTimestampService { + import Operations = SimpleTypesTimestampImpl + + function method DefaultSimpleTimestampConfig(): SimpleTimestampConfig { + SimpleTimestampConfig + } + + method SimpleTimestamp(config: SimpleTimestampConfig) + returns (res: Result) + { + var client := new SimpleTimestampClient(Operations.Config); + return Success(client); + } + + class SimpleTimestampClient... { + predicate ValidState() { + && Operations.ValidInternalConfig?(config) + && Modifies == Operations.ModifiesInternalConfig(config) + {History} + } + + constructor(config: Operations.InternalConfig) { + this.config := config; + History := new ISimpleTypesTimestampClientCallHistory(); + Modifies := Operations.ModifiesInternalConfig(config) + {History}; + } + } +} diff --git a/TestModels/Union/Makefile b/TestModels/Union/Makefile index 3a2b16838..ab1422214 100644 --- a/TestModels/Union/Makefile +++ b/TestModels/Union/Makefile @@ -3,6 +3,8 @@ CORES=2 +RUST_BENERATED=1 + include ../SharedMakefile.mk NAMESPACE=simple.union diff --git a/TestModels/Union/codegen-patches/rust/dafny-4.5.0.patch b/TestModels/Union/codegen-patches/rust/dafny-4.5.0.patch deleted file mode 100644 index ef1adc342..000000000 --- a/TestModels/Union/codegen-patches/rust/dafny-4.5.0.patch +++ /dev/null @@ -1,1525 +0,0 @@ -diff --git b/TestModels/Union/runtimes/rust/src/client.rs a/TestModels/Union/runtimes/rust/src/client.rs -new file mode 100644 -index 00000000..437b70f3 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/client.rs -@@ -0,0 +1,40 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+use aws_smithy_types::error::operation::BuildError; -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct Client { -+ pub(crate) dafny_client: ::dafny_runtime::Object< -+ dyn crate::r#simple::union::internaldafny::types::ISimpleUnionClient, -+ >, -+} -+ -+impl Client { -+ /// Creates a new client from the service [`Config`](crate::Config). -+ #[track_caller] -+ pub fn from_conf( -+ conf: crate::types::simple_union_config::SimpleUnionConfig, -+ ) -> Result { -+ let inner = crate::simple::union::internaldafny::_default::SimpleUnion( -+ &crate::conversions::simple_union_config::_simple_union_config::to_dafny(conf), -+ ); -+ if matches!( -+ inner.as_ref(), -+ crate::_Wrappers_Compile::Result::Failure { .. } -+ ) { -+ // TODO: convert error - the potential types are not modeled! -+ return Err(BuildError::other( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Invalid client config") -+ .build(), -+ )); -+ } -+ Ok(Self { -+ dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()), -+ }) -+ } -+} -+ -+mod get_union; -+ -+mod get_union_known_value; -diff --git b/TestModels/Union/runtimes/rust/src/client/get_union.rs a/TestModels/Union/runtimes/rust/src/client/get_union.rs -new file mode 100644 -index 00000000..7a1acd59 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/client/get_union.rs -@@ -0,0 +1,15 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetUnion`](crate::operation::get_union::builders::GetUnionFluentBuilder) operation. -+ /// -+ /// - The fluent builder is configurable: -+ /// - [`union(MyUnion)`](crate::operation::get_union::builders::GetUnionFluentBuilder::union) / [`set_union(Option)`](crate::operation::get_union::builders::GetUnionFluentBuilder::set_union):
required: **false**
(undocumented)
-+ /// - [`value(i32)`](crate::operation::get_union::builders::GetUnionFluentBuilder::value) / [`set_value(Option)`](crate::operation::get_union::builders::GetUnionFluentBuilder::set_value):(undocumented)
-+ /// - On success, responds with [`GetUnionOutput`](crate::operation::get_union::GetUnionOutput) with field(s): -+ /// - [`union(Option)`](crate::operation::get_union::GetUnionOutput::union): (undocumented) -+ /// - [`value(Option)`](crate::operation::get_union::GetUnionOutput::value): (undocumented) -+ /// - On failure, responds with [`SdkError`](crate::operation::get_union::GetUnionError) -+ pub fn get_union(&self) -> crate::operation::get_union::builders::GetUnionFluentBuilder { -+ crate::operation::get_union::builders::GetUnionFluentBuilder::new(self.clone()) -+ } -+} -diff --git b/TestModels/Union/runtimes/rust/src/client/get_union_known_value.rs a/TestModels/Union/runtimes/rust/src/client/get_union_known_value.rs -new file mode 100644 -index 00000000..22e35f21 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/client/get_union_known_value.rs -@@ -0,0 +1,17 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+impl super::Client { -+ /// Constructs a fluent builder for the [`GetKnownValueUnion`](crate::operation::get_known_value_union::builders::GetKnownValueUnionFluentBuilder) operation. -+ /// -+ /// - The fluent builder is configurable: -+ /// - [`union(KnownValueUnion)`](crate::operation::get_known_value_union::builders::GetKnownValueUnionFluentBuilder::union) / [`set_union(Option)`](crate::operation::get_known_value_union::builders::GetKnownValueUnionFluentBuilder::set_union):
required: **false**
(undocumented)
-+ /// - On success, responds with [`GetKnownValueUnionOutput`](crate::operation::get_known_value_union::GetKnownValueUnionOutput) with field(s): -+ /// - [`union(Option)`](crate::operation::get_known_value_union::GetKnownValueUnionOutput::union): (undocumented) -+ /// - On failure, responds with [`SdkError`](crate::operation::get_known_value_union::GetKnownValueUnionError) -+ pub fn get_union_known_value( -+ &self, -+ ) -> crate::operation::get_known_value_union::builders::GetKnownValueUnionFluentBuilder { -+ crate::operation::get_known_value_union::builders::GetKnownValueUnionFluentBuilder::new( -+ self.clone(), -+ ) -+ } -+} -diff --git b/TestModels/Union/runtimes/rust/src/conversions.rs a/TestModels/Union/runtimes/rust/src/conversions.rs -new file mode 100644 -index 00000000..375f610e ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/conversions.rs -@@ -0,0 +1,6 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub mod get_union; -+ -+pub mod get_known_value_union; -+ -+pub mod simple_union_config; -diff --git b/TestModels/Union/runtimes/rust/src/conversions/get_known_value_union.rs a/TestModels/Union/runtimes/rust/src/conversions/get_known_value_union.rs -new file mode 100644 -index 00000000..d8ba15d7 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/conversions/get_known_value_union.rs -@@ -0,0 +1,48 @@ -+// 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_known_value_union::GetKnownValueUnionError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_known_value_union::GetKnownValueUnionError::Unhandled(unhandled) => { -+ ::std::rc::Rc::new( -+ crate::r#simple::union::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::operation::get_known_value_union::GetKnownValueUnionError { -+ // 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::union::internaldafny::types::Error::CollectionOfErrors { .. } -+ ) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_known_value_union::GetKnownValueUnionError::generic( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message(error_message) -+ .build(), -+ ) -+ } else { -+ crate::operation::get_known_value_union::GetKnownValueUnionError::generic( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Opaque error") -+ .build(), -+ ) -+ } -+} -+ -+pub mod _get_known_value_union_input; -+ -+pub mod _get_known_value_union_output; -diff --git b/TestModels/Union/runtimes/rust/src/conversions/get_known_value_union/_get_known_value_union_input.rs a/TestModels/Union/runtimes/rust/src/conversions/get_known_value_union/_get_known_value_union_input.rs -new file mode 100644 -index 00000000..05142362 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/conversions/get_known_value_union/_get_known_value_union_input.rs -@@ -0,0 +1,56 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_known_value_union::GetKnownValueUnionInput, -+) -> ::std::rc::Rc< -+ crate::r#simple::union::internaldafny::types::GetKnownValueUnionInput, -+> { -+ let dafny_value = match value.value { -+ Some(v) => crate::_Wrappers_Compile::Option::Some { -+ value: { -+ let v = match v { -+ crate::types::_known_value_union::KnownValueUnion::Value(n) => { -+ crate::simple::union::internaldafny::types::KnownValueUnion::Value { Value: n } -+ } -+ crate::types::_known_value_union::KnownValueUnion::Unknown => unreachable!() -+ }; -+ -+ ::std::rc::Rc::new(v) -+ }, -+ }, -+ None => crate::_Wrappers_Compile::Option::None {}, -+ }; -+ ::std::rc::Rc::new(crate::r#simple::union::internaldafny::types::GetKnownValueUnionInput::GetKnownValueUnionInput { -+ r#union: ::std::rc::Rc::new(dafny_value) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::union::internaldafny::types::GetKnownValueUnionInput, -+ >, -+) -> crate::operation::get_known_value_union::GetKnownValueUnionInput { -+ let value = if matches!( -+ dafny_value.union().as_ref(), -+ crate::_Wrappers_Compile::Option::Some { .. } -+ ) { -+ let v = dafny_value.union().Extract(); -+ let v = ::std::rc::Rc::try_unwrap(v).unwrap_or_else(|rc| (*rc).clone()); -+ let v = match v { -+ crate::simple::union::internaldafny::types::KnownValueUnion::Value { -+ Value, -+ } => crate::types::_known_value_union::KnownValueUnion::Value(Value), -+ }; -+ Some(v) -+ } else if matches!( -+ dafny_value.union().as_ref(), -+ crate::_Wrappers_Compile::Option::None { .. } -+ ) { -+ None -+ } else { -+ panic!("Unreachable") -+ }; -+ -+ crate::operation::get_known_value_union::GetKnownValueUnionInput { value } -+} -diff --git b/TestModels/Union/runtimes/rust/src/conversions/get_known_value_union/_get_known_value_union_output.rs a/TestModels/Union/runtimes/rust/src/conversions/get_known_value_union/_get_known_value_union_output.rs -new file mode 100644 -index 00000000..a6222365 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/conversions/get_known_value_union/_get_known_value_union_output.rs -@@ -0,0 +1,54 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_known_value_union::GetKnownValueUnionOutput, -+) -> ::std::rc::Rc { -+ let dafny_value = match value.union { -+ Some(v) => crate::_Wrappers_Compile::Option::Some { -+ value: { -+ let v = match v { -+ crate::types::_known_value_union::KnownValueUnion::Value(n) => { -+ crate::simple::union::internaldafny::types::MyUnion::IntegerValue { IntegerValue: n } -+ } -+ crate::types::_known_value_union::KnownValueUnion::Unknown => unreachable!(), -+ }; -+ -+ ::std::rc::Rc::new(v) -+ }, -+ }, -+ None => crate::_Wrappers_Compile::Option::None {}, -+ }; -+ ::std::rc::Rc::new(crate::r#simple::union::internaldafny::types::GetUnionOutput::GetUnionOutput { -+ r#union: ::std::rc::Rc::new(dafny_value) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::union::internaldafny::types::GetKnownValueUnionOutput, -+ >, -+) -> crate::operation::get_known_value_union::GetKnownValueUnionOutput { -+ let union = if matches!( -+ dafny_value.union().as_ref(), -+ crate::_Wrappers_Compile::Option::Some { .. } -+ ) { -+ let v = dafny_value.union().Extract(); -+ let v = ::std::rc::Rc::try_unwrap(v).unwrap_or_else(|rc| (*rc).clone()); -+ let v = match v { -+ crate::simple::union::internaldafny::types::KnownValueUnion::Value { -+ Value, -+ } => crate::types::_known_value_union::KnownValueUnion::Value(Value), -+ }; -+ Some(v) -+ } else if matches!( -+ dafny_value.union().as_ref(), -+ crate::_Wrappers_Compile::Option::None { .. } -+ ) { -+ None -+ } else { -+ panic!("Unreachable") -+ }; -+ -+ crate::operation::get_known_value_union::GetKnownValueUnionOutput { union } -+} -diff --git b/TestModels/Union/runtimes/rust/src/conversions/get_union.rs a/TestModels/Union/runtimes/rust/src/conversions/get_union.rs -new file mode 100644 -index 00000000..9d32485a ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/conversions/get_union.rs -@@ -0,0 +1,46 @@ -+// 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_union::GetUnionError, -+) -> ::std::rc::Rc { -+ match value { -+ crate::operation::get_union::GetUnionError::Unhandled(unhandled) => ::std::rc::Rc::new( -+ crate::r#simple::union::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::operation::get_union::GetUnionError { -+ // 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::union::internaldafny::types::Error::CollectionOfErrors { .. } -+ ) { -+ let error_message = "TODO: can't get message yet"; -+ crate::operation::get_union::GetUnionError::generic( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message(error_message) -+ .build(), -+ ) -+ } else { -+ crate::operation::get_union::GetUnionError::generic( -+ ::aws_smithy_types::error::metadata::ErrorMetadata::builder() -+ .message("Opaque error") -+ .build(), -+ ) -+ } -+} -+ -+pub mod _get_union_input; -+ -+pub mod _get_union_output; -diff --git b/TestModels/Union/runtimes/rust/src/conversions/get_union/_get_union_input.rs a/TestModels/Union/runtimes/rust/src/conversions/get_union/_get_union_input.rs -new file mode 100644 -index 00000000..ec0294ea ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/conversions/get_union/_get_union_input.rs -@@ -0,0 +1,60 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_union::GetUnionInput, -+) -> ::std::rc::Rc { -+ let dafny_value = match value.union { -+ Some(v) => crate::_Wrappers_Compile::Option::Some { -+ value: { -+ let v = match v { -+ crate::types::_my_union::MyUnion::IntegerValue(n) => { -+ crate::simple::union::internaldafny::types::MyUnion::IntegerValue { IntegerValue: n } -+ } -+ crate::types::_my_union::MyUnion::StringValue(s) => crate::simple::union::internaldafny::types::MyUnion::StringValue { StringValue: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) }, -+ crate::types::_my_union::MyUnion::Unknown => unreachable!(), -+ }; -+ -+ ::std::rc::Rc::new(v) -+ }, -+ }, -+ None => crate::_Wrappers_Compile::Option::None {}, -+ }; -+ ::std::rc::Rc::new(crate::r#simple::union::internaldafny::types::GetUnionInput::GetUnionInput { -+ r#union: ::std::rc::Rc::new(dafny_value) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::union::internaldafny::types::GetUnionInput, -+ >, -+) -> crate::operation::get_union::GetUnionInput { -+ let value = if matches!( -+ dafny_value.union().as_ref(), -+ crate::_Wrappers_Compile::Option::Some { .. } -+ ) { -+ let v = dafny_value.union().Extract(); -+ let v = ::std::rc::Rc::try_unwrap(v).unwrap_or_else(|rc| (*rc).clone()); -+ let v = match v { -+ crate::simple::union::internaldafny::types::MyUnion::IntegerValue { -+ IntegerValue, -+ } => crate::types::_my_union::MyUnion::IntegerValue(IntegerValue), -+ crate::simple::union::internaldafny::types::MyUnion::StringValue { -+ StringValue, -+ } => crate::types::_my_union::MyUnion::StringValue(dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( -+ &StringValue, -+ )), -+ }; -+ Some(v) -+ } else if matches!( -+ dafny_value.union().as_ref(), -+ crate::_Wrappers_Compile::Option::None { .. } -+ ) { -+ None -+ } else { -+ panic!("Unreachable") -+ }; -+ -+ crate::operation::get_union::GetUnionInput { union: value } -+} -diff --git b/TestModels/Union/runtimes/rust/src/conversions/get_union/_get_union_output.rs a/TestModels/Union/runtimes/rust/src/conversions/get_union/_get_union_output.rs -new file mode 100644 -index 00000000..08fc13f5 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/conversions/get_union/_get_union_output.rs -@@ -0,0 +1,60 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+pub fn to_dafny( -+ value: crate::operation::get_union::GetUnionOutput, -+) -> ::std::rc::Rc { -+ let dafny_value = match value.union { -+ Some(v) => crate::_Wrappers_Compile::Option::Some { -+ value: { -+ let v = match v { -+ crate::types::_my_union::MyUnion::IntegerValue(n) => { -+ crate::simple::union::internaldafny::types::MyUnion::IntegerValue { IntegerValue: n } -+ } -+ crate::types::_my_union::MyUnion::StringValue(s) => crate::simple::union::internaldafny::types::MyUnion::StringValue { StringValue: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) }, -+ crate::types::_my_union::MyUnion::Unknown => unreachable!(), -+ }; -+ -+ ::std::rc::Rc::new(v) -+ }, -+ }, -+ None => crate::_Wrappers_Compile::Option::None {}, -+ }; -+ ::std::rc::Rc::new(crate::r#simple::union::internaldafny::types::GetUnionOutput::GetUnionOutput { -+ r#union: ::std::rc::Rc::new(dafny_value) -+ }) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::union::internaldafny::types::GetUnionOutput, -+ >, -+) -> crate::operation::get_union::GetUnionOutput { -+ let union = if matches!( -+ dafny_value.union().as_ref(), -+ crate::_Wrappers_Compile::Option::Some { .. } -+ ) { -+ let v = dafny_value.union().Extract(); -+ let v = ::std::rc::Rc::try_unwrap(v).unwrap_or_else(|rc| (*rc).clone()); -+ let v = match v { -+ crate::simple::union::internaldafny::types::MyUnion::IntegerValue { -+ IntegerValue, -+ } => crate::types::_my_union::MyUnion::IntegerValue(IntegerValue), -+ crate::simple::union::internaldafny::types::MyUnion::StringValue { -+ StringValue, -+ } => crate::types::_my_union::MyUnion::StringValue(dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( -+ &StringValue, -+ )), -+ }; -+ Some(v) -+ } else if matches!( -+ dafny_value.union().as_ref(), -+ crate::_Wrappers_Compile::Option::None { .. } -+ ) { -+ None -+ } else { -+ panic!("Unreachable") -+ }; -+ -+ crate::operation::get_union::GetUnionOutput { union } -+} -diff --git b/TestModels/Union/runtimes/rust/src/conversions/simple_union_config.rs a/TestModels/Union/runtimes/rust/src/conversions/simple_union_config.rs -new file mode 100644 -index 00000000..f47a69b4 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/conversions/simple_union_config.rs -@@ -0,0 +1,3 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _simple_union_config; -diff --git b/TestModels/Union/runtimes/rust/src/conversions/simple_union_config/_simple_union_config.rs a/TestModels/Union/runtimes/rust/src/conversions/simple_union_config/_simple_union_config.rs -new file mode 100644 -index 00000000..773e0e4f ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/conversions/simple_union_config/_simple_union_config.rs -@@ -0,0 +1,17 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+#[allow(dead_code)] -+ -+pub fn to_dafny( -+ value: crate::types::simple_union_config::SimpleUnionConfig, -+) -> ::std::rc::Rc { -+ ::std::rc::Rc::new(crate::r#simple::union::internaldafny::types::SimpleUnionConfig::SimpleUnionConfig {}) -+} -+ -+#[allow(dead_code)] -+pub fn from_dafny( -+ dafny_value: ::std::rc::Rc< -+ crate::r#simple::union::internaldafny::types::SimpleUnionConfig, -+ >, -+) -> crate::types::simple_union_config::SimpleUnionConfig { -+ crate::types::simple_union_config::SimpleUnionConfig {} -+} -diff --git b/TestModels/Union/runtimes/rust/src/error.rs a/TestModels/Union/runtimes/rust/src/error.rs -new file mode 100644 -index 00000000..ec89cbec ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/error.rs -@@ -0,0 +1,14 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use ::aws_smithy_runtime_api::box_error::BoxError; -+ -+/// Error type returned by the client. -+pub type SdkError = -+ ::aws_smithy_runtime_api::client::result::SdkError; -+pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -+pub use ::aws_smithy_types::error::operation::BuildError; -+ -+pub use ::aws_smithy_types::error::display::DisplayErrorContext; -+pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -+pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; -+ -+pub(crate) mod sealed_unhandled; -diff --git b/TestModels/Union/runtimes/rust/src/error/sealed_unhandled.rs a/TestModels/Union/runtimes/rust/src/error/sealed_unhandled.rs -new file mode 100644 -index 00000000..cce22d1c ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/error/sealed_unhandled.rs -@@ -0,0 +1,26 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// This struct is not intended to be used. -+/// -+/// This struct holds information about an unhandled error, -+/// but that information should be obtained by using the -+/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -+/// on the error type. -+/// -+/// This struct intentionally doesn't yield any useful information itself. -+#[deprecated( -+ note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -+variable wildcard pattern and check `.code()`: -+ \ -+   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -+)] -+#[derive(Debug)] -+pub struct Unhandled { -+ pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, -+ pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -+} -+ -+impl ::dafny_runtime::UpcastObject for Unhandled { -+ ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -+} -diff --git b/TestModels/Union/runtimes/rust/src/implementation_from_dafny.rs a/TestModels/Union/runtimes/rust/src/implementation_from_dafny.rs -index 49d30605..a49d9b04 100644 ---- b/TestModels/Union/runtimes/rust/src/implementation_from_dafny.rs -+++ a/TestModels/Union/runtimes/rust/src/implementation_from_dafny.rs -@@ -1,6 +1,20 @@ - #![allow(warnings, unconditional_panic)] - #![allow(nonstandard_style)] - -+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_union_config::SimpleUnionConfig; -+ - pub mod r#_Wrappers_Compile { - pub use dafny_runtime::DafnyPrint; - pub use std::cmp::Eq; -diff --git b/TestModels/Union/runtimes/rust/src/lib.rs a/TestModels/Union/runtimes/rust/src/lib.rs -new file mode 100644 -index 00000000..6c0e841e ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/lib.rs -@@ -0,0 +1,19 @@ -+#![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_union_config::SimpleUnionConfig; -diff --git b/TestModels/Union/runtimes/rust/src/operation.rs a/TestModels/Union/runtimes/rust/src/operation.rs -new file mode 100644 -index 00000000..91564304 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/operation.rs -@@ -0,0 +1,7 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+/// Types for the `GetUnion` operation. -+pub mod get_union; -+ -+/// Types for the `GetKnownValueUnion` operation. -+pub mod get_known_value_union; -diff --git b/TestModels/Union/runtimes/rust/src/operation/get_known_value_union.rs a/TestModels/Union/runtimes/rust/src/operation/get_known_value_union.rs -new file mode 100644 -index 00000000..1bbf03ca ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/operation/get_known_value_union.rs -@@ -0,0 +1,148 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetKnownValueUnion`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetKnownValueUnion; -+impl GetKnownValueUnion { -+ /// Creates a new `GetKnownValueUnion` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_known_value_union::GetKnownValueUnionInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_known_value_union::GetKnownValueUnionOutput, -+ crate::operation::get_known_value_union::GetKnownValueUnionError, -+ > { -+ let inner_input = -+ crate::conversions::get_known_value_union::_get_known_value_union_input::to_dafny( -+ input, -+ ); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetKnownValueUnion(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_known_value_union::_get_known_value_union_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_known_value_union::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetKnownValueUnion` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetKnownValueUnionError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetKnownValueUnionError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetKnownValueUnionError { -+ /// Creates the `GetKnownValueUnionError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetKnownValueUnionError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetKnownValueUnionError { -+ 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 GetKnownValueUnionError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetKnownValueUnionError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetKnownValueUnionError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetKnownValueUnionError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_known_value_union::_get_known_value_union_output::GetKnownValueUnionOutput; -+ -+pub use crate::operation::get_known_value_union::_get_known_value_union_input::GetKnownValueUnionInput; -+ -+mod _get_known_value_union_input; -+ -+mod _get_known_value_union_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/Union/runtimes/rust/src/operation/get_known_value_union/_get_known_value_union_input.rs a/TestModels/Union/runtimes/rust/src/operation/get_known_value_union/_get_known_value_union_input.rs -new file mode 100644 -index 00000000..bfe340c3 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/operation/get_known_value_union/_get_known_value_union_input.rs -@@ -0,0 +1,64 @@ -+// 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 GetKnownValueUnionInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub value: ::std::option::Option, -+} -+impl GetKnownValueUnionInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value( -+ &self, -+ ) -> &::std::option::Option { -+ &self.value -+ } -+} -+impl GetKnownValueUnionInput { -+ /// Creates a new builder-style object to manufacture [`GetKnownValueUnionInput`](crate::operation::get_known_value_union::GetKnownValueUnionInput). -+ pub fn builder( -+ ) -> crate::operation::get_known_value_union::builders::GetKnownValueUnionInputBuilder { -+ crate::operation::get_known_value_union::builders::GetKnownValueUnionInputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetKnownValueUnionInput`](crate::operation::get_known_value_union::GetKnownValueUnionInput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetKnownValueUnionInputBuilder { -+ pub(crate) value: ::std::option::Option, -+} -+impl GetKnownValueUnionInputBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(mut self, input: crate::types::_known_value_union::KnownValueUnion) -> 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, -+ ) -> 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 [`GetKnownValueUnionInput`](crate::operation::get_known_value_union::GetKnownValueUnionInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_known_value_union::GetKnownValueUnionInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok( -+ crate::operation::get_known_value_union::GetKnownValueUnionInput { value: self.value }, -+ ) -+ } -+} -diff --git b/TestModels/Union/runtimes/rust/src/operation/get_known_value_union/_get_known_value_union_output.rs a/TestModels/Union/runtimes/rust/src/operation/get_known_value_union/_get_known_value_union_output.rs -new file mode 100644 -index 00000000..1d9fcfa9 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/operation/get_known_value_union/_get_known_value_union_output.rs -@@ -0,0 +1,68 @@ -+// 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 GetKnownValueUnionOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub union: ::std::option::Option, -+} -+impl GetKnownValueUnionOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value( -+ &self, -+ ) -> ::std::option::Option<&crate::types::_known_value_union::KnownValueUnion> { -+ self.union.as_ref() -+ } -+} -+impl GetKnownValueUnionOutput { -+ /// Creates a new builder-style object to manufacture [`GetKnownValueUnionOutput`](crate::operation::get_union_known_value::GetKnownValueUnionOutput). -+ pub fn builder( -+ ) -> crate::operation::get_known_value_union::builders::GetKnownValueUnionOutputBuilder { -+ crate::operation::get_known_value_union::builders::GetKnownValueUnionOutputBuilder::default( -+ ) -+ } -+} -+ -+/// A builder for [`GetKnownValueUnionOutput`](crate::operation::get_union_known_value::GetKnownValueUnionOutput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetKnownValueUnionOutputBuilder { -+ pub(crate) value: ::std::option::Option, -+} -+impl GetKnownValueUnionOutputBuilder { -+ #[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 [`GetKnownValueUnionOutput`](crate::operation::get_union_known_value::GetKnownValueUnionOutput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_known_value_union::GetKnownValueUnionOutput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok( -+ crate::operation::get_known_value_union::GetKnownValueUnionOutput { union: self.value }, -+ ) -+ } -+} -diff --git b/TestModels/Union/runtimes/rust/src/operation/get_known_value_union/builders.rs a/TestModels/Union/runtimes/rust/src/operation/get_known_value_union/builders.rs -new file mode 100644 -index 00000000..bff69f92 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/operation/get_known_value_union/builders.rs -@@ -0,0 +1,79 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_known_value_union::_get_known_value_union_output::GetKnownValueUnionOutputBuilder; -+ -+pub use crate::operation::get_known_value_union::_get_known_value_union_input::GetKnownValueUnionInputBuilder; -+ -+impl GetKnownValueUnionInputBuilder { -+ /// 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_known_value_union::GetKnownValueUnionOutput, -+ crate::operation::get_known_value_union::GetKnownValueUnionError, -+ > { -+ let mut fluent_builder = client.get_union_known_value(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetKnownValueUnion`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetKnownValueUnionFluentBuilder { -+ client: crate::client::Client, -+ inner: crate::operation::get_known_value_union::builders::GetKnownValueUnionInputBuilder, -+} -+impl GetKnownValueUnionFluentBuilder { -+ /// Creates a new `GetKnownValueUnionFluentBuilder`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetKnownValueUnion as a reference. -+ pub fn as_input( -+ &self, -+ ) -> &crate::operation::get_known_value_union::builders::GetKnownValueUnionInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_known_value_union::GetKnownValueUnionOutput, -+ crate::operation::get_known_value_union::GetKnownValueUnionError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetUnion 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_known_value_union::GetKnownValueUnionError::unhandled)?; -+ crate::operation::get_known_value_union::GetKnownValueUnion::send(&self.client, input).await -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(mut self, input: crate::types::_known_value_union::KnownValueUnion) -> 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 b/TestModels/Union/runtimes/rust/src/operation/get_union.rs a/TestModels/Union/runtimes/rust/src/operation/get_union.rs -new file mode 100644 -index 00000000..66f6e875 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/operation/get_union.rs -@@ -0,0 +1,145 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+/// Orchestration and serialization glue logic for `GetUnion`. -+#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -+#[non_exhaustive] -+pub struct GetUnion; -+impl GetUnion { -+ /// Creates a new `GetUnion` -+ pub fn new() -> Self { -+ Self -+ } -+ pub(crate) async fn send( -+ client: &crate::client::Client, -+ input: crate::operation::get_union::GetUnionInput, -+ ) -> ::std::result::Result< -+ crate::operation::get_union::GetUnionOutput, -+ crate::operation::get_union::GetUnionError, -+ > { -+ let inner_input = crate::conversions::get_union::_get_union_input::to_dafny(input); -+ let inner_result = -+ ::dafny_runtime::md!(client.dafny_client.clone()).GetUnion(&inner_input); -+ if matches!( -+ inner_result.as_ref(), -+ crate::r#_Wrappers_Compile::Result::Success { .. } -+ ) { -+ Ok( -+ crate::conversions::get_union::_get_union_output::from_dafny( -+ inner_result.value().clone(), -+ ), -+ ) -+ } else { -+ Err(crate::conversions::get_union::from_dafny_error( -+ inner_result.error().clone(), -+ )) -+ } -+ } -+} -+ -+/// Error type for the `GetUnion` operation. -+#[non_exhaustive] -+#[derive(::std::fmt::Debug)] -+pub enum GetUnionError { -+ /// 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()`: -+ \ -+    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` -+ \ -+ See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetUnionError) for what information is available for the error." -+ )] -+ Unhandled(crate::error::sealed_unhandled::Unhandled), -+} -+impl GetUnionError { -+ /// Creates the `GetUnionError::Unhandled` variant from any error type. -+ pub fn unhandled( -+ err: impl ::std::convert::Into< -+ ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ >, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source: err.into(), -+ meta: ::std::default::Default::default(), -+ }) -+ } -+ -+ /// Creates the `GetUnionError::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(), -+ meta: err, -+ }) -+ } -+ /// -+ /// Returns error metadata, which includes the error code, message, -+ /// request ID, and potentially additional information. -+ /// -+ pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(e) => &e.meta, -+ } -+ } -+} -+impl ::std::error::Error for GetUnionError { -+ 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 GetUnionError { -+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { -+ match self { -+ Self::Unhandled(_inner) => { -+ if let ::std::option::Option::Some(code) = -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ { -+ write!(f, "unhandled error ({code})") -+ } else { -+ f.write_str("unhandled error") -+ } -+ } -+ } -+ } -+} -+impl ::aws_smithy_types::retry::ProvideErrorKind for GetUnionError { -+ fn code(&self) -> ::std::option::Option<&str> { -+ ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) -+ } -+ fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { -+ ::std::option::Option::None -+ } -+} -+impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetUnionError { -+ fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { -+ match self { -+ Self::Unhandled(_inner) => &_inner.meta, -+ } -+ } -+} -+impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetUnionError { -+ fn create_unhandled_error( -+ source: ::std::boxed::Box< -+ dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, -+ >, -+ meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>, -+ ) -> Self { -+ Self::Unhandled(crate::error::sealed_unhandled::Unhandled { -+ source, -+ meta: meta.unwrap_or_default(), -+ }) -+ } -+} -+ -+pub use crate::operation::get_union::_get_union_output::GetUnionOutput; -+ -+pub use crate::operation::get_union::_get_union_input::GetUnionInput; -+ -+mod _get_union_input; -+ -+mod _get_union_output; -+ -+/// Builders -+pub mod builders; -diff --git b/TestModels/Union/runtimes/rust/src/operation/get_union/_get_union_input.rs a/TestModels/Union/runtimes/rust/src/operation/get_union/_get_union_input.rs -new file mode 100644 -index 00000000..cb4bef47 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/operation/get_union/_get_union_input.rs -@@ -0,0 +1,57 @@ -+// 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 GetUnionInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub union: ::std::option::Option, -+} -+impl GetUnionInput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option<&crate::types::_my_union::MyUnion> { -+ self.union.as_ref() -+ } -+} -+impl GetUnionInput { -+ /// Creates a new builder-style object to manufacture [`GetUnionInput`](crate::operation::get_union::GetUnionInput). -+ pub fn builder() -> crate::operation::get_union::builders::GetUnionInputBuilder { -+ crate::operation::get_union::builders::GetUnionInputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetUnionInput`](crate::operation::get_union::GetUnionInput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetUnionInputBuilder { -+ pub(crate) value: ::std::option::Option, -+} -+impl GetUnionInputBuilder { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(mut self, input: crate::types::_my_union::MyUnion) -> 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, -+ ) -> 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 [`GetUnionInput`](crate::operation::get_union::GetUnionInput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_union::GetUnionInput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_union::GetUnionInput { union: self.value }) -+ } -+} -diff --git b/TestModels/Union/runtimes/rust/src/operation/get_union/_get_union_output.rs a/TestModels/Union/runtimes/rust/src/operation/get_union/_get_union_output.rs -new file mode 100644 -index 00000000..f8992384 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/operation/get_union/_get_union_output.rs -@@ -0,0 +1,66 @@ -+// 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 GetUnionOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub union: ::std::option::Option, -+} -+ -+impl GetUnionOutput { -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(&self) -> ::std::option::Option<&crate::types::_my_union::MyUnion> { -+ self.union.as_ref() -+ } -+} -+ -+impl GetUnionOutput { -+ /// Creates a new builder-style object to manufacture [`GetUnionOutput`](crate::operation::get_union::GetUnionOutput). -+ pub fn builder() -> crate::operation::get_union::builders::GetUnionOutputBuilder { -+ crate::operation::get_union::builders::GetUnionOutputBuilder::default() -+ } -+} -+ -+/// A builder for [`GetUnionOutput`](crate::operation::get_union::GetUnionOutput). -+#[non_exhaustive] -+#[derive( -+ ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -+)] -+pub struct GetUnionOutputBuilder { -+ pub(crate) value: ::std::option::Option, -+} -+ -+impl GetUnionOutputBuilder { -+ #[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 [`GetUnionOutput`](crate::operation::get_union::GetUnionOutput). -+ pub fn build( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_union::GetUnionOutput, -+ ::aws_smithy_types::error::operation::BuildError, -+ > { -+ ::std::result::Result::Ok(crate::operation::get_union::GetUnionOutput { union: self.value }) -+ } -+} -diff --git b/TestModels/Union/runtimes/rust/src/operation/get_union/builders.rs a/TestModels/Union/runtimes/rust/src/operation/get_union/builders.rs -new file mode 100644 -index 00000000..2409bdcf ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/operation/get_union/builders.rs -@@ -0,0 +1,75 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+pub use crate::operation::get_union::_get_union_output::GetUnionOutputBuilder; -+ -+pub use crate::operation::get_union::_get_union_input::GetUnionInputBuilder; -+ -+impl GetUnionInputBuilder { -+ /// 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_union::GetUnionOutput, -+ crate::operation::get_union::GetUnionError, -+ > { -+ let mut fluent_builder = client.get_union(); -+ fluent_builder.inner = self; -+ fluent_builder.send().await -+ } -+} -+/// Fluent builder constructing a request to `GetUnion`. -+/// -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct GetUnionFluentBuilder { -+ client: crate::Client, -+ inner: crate::operation::get_union::builders::GetUnionInputBuilder, -+} -+impl GetUnionFluentBuilder { -+ /// Creates a new `GetUnionFluentBuilder`. -+ pub(crate) fn new(client: crate::client::Client) -> Self { -+ Self { -+ client, -+ inner: ::std::default::Default::default(), -+ } -+ } -+ /// Access the GetUnion as a reference. -+ pub fn as_input(&self) -> &crate::operation::get_union::builders::GetUnionInputBuilder { -+ &self.inner -+ } -+ /// Sends the request and returns the response. -+ pub async fn send( -+ self, -+ ) -> ::std::result::Result< -+ crate::operation::get_union::GetUnionOutput, -+ crate::operation::get_union::GetUnionError, -+ > { -+ let input = self -+ .inner -+ .build() -+ // Using unhandled since GetUnion 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_union::GetUnionError::unhandled)?; -+ crate::operation::get_union::GetUnion::send(&self.client, input).await -+ } -+ -+ #[allow(missing_docs)] // documentation missing in model -+ pub fn value(mut self, input: crate::types::_my_union::MyUnion) -> 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 b/TestModels/Union/runtimes/rust/src/types.rs a/TestModels/Union/runtimes/rust/src/types.rs -new file mode 100644 -index 00000000..d03e8b5a ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/types.rs -@@ -0,0 +1,6 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+pub mod _known_value_union; -+pub mod _my_union; -+/// Types for the `SimpleUnionConfig` -+pub mod simple_union_config; -diff --git b/TestModels/Union/runtimes/rust/src/types/_known_value_union.rs a/TestModels/Union/runtimes/rust/src/types/_known_value_union.rs -new file mode 100644 -index 00000000..a778d4b4 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/types/_known_value_union.rs -@@ -0,0 +1,37 @@ -+// 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 enum KnownValueUnion { -+ #[allow(missing_docs)] // documentation missing in model -+ Value(i32), -+ /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version. -+ /// An unknown enum variant -+ /// -+ /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._ -+ /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized -+ /// by the client. This can happen when the server adds new functionality, but the client has not been updated. -+ /// To investigate this, consider turning on debug logging to print the raw HTTP response. -+ #[non_exhaustive] -+ Unknown, -+} -+impl KnownValueUnion { -+ #[allow(irrefutable_let_patterns)] -+ /// Tries to convert the enum instance into [`Value`](crate::types::KnownValueUnion::Value), extracting the inner [`i32`](i32). -+ /// Returns `Err(&Self)` if it can't be converted. -+ pub fn as_value(&self) -> ::std::result::Result<&i32, &Self> { -+ if let KnownValueUnion::Value(val) = &self { -+ ::std::result::Result::Ok(val) -+ } else { -+ ::std::result::Result::Err(self) -+ } -+ } -+ /// Returns true if this is a [`Value`](crate::types::KnownValueUnion::Value). -+ pub fn is_value(&self) -> bool { -+ self.as_value().is_ok() -+ } -+ /// Returns true if the enum instance is the `Unknown` variant. -+ pub fn is_unknown(&self) -> bool { -+ matches!(self, Self::Unknown) -+ } -+} -diff --git b/TestModels/Union/runtimes/rust/src/types/_my_union.rs a/TestModels/Union/runtimes/rust/src/types/_my_union.rs -new file mode 100644 -index 00000000..1f461092 ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/types/_my_union.rs -@@ -0,0 +1,51 @@ -+// 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 enum MyUnion { -+ #[allow(missing_docs)] // documentation missing in model -+ IntegerValue(i32), -+ #[allow(missing_docs)] // documentation missing in model -+ StringValue(::std::string::String), -+ /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version. -+ /// An unknown enum variant -+ /// -+ /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._ -+ /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized -+ /// by the client. This can happen when the server adds new functionality, but the client has not been updated. -+ /// To investigate this, consider turning on debug logging to print the raw HTTP response. -+ #[non_exhaustive] -+ Unknown, -+} -+impl MyUnion { -+ /// Tries to convert the enum instance into [`IntegerValue`](crate::types::MyUnion::IntegerValue), extracting the inner [`i32`](i32). -+ /// Returns `Err(&Self)` if it can't be converted. -+ pub fn as_integer_value(&self) -> ::std::result::Result<&i32, &Self> { -+ if let MyUnion::IntegerValue(val) = &self { -+ ::std::result::Result::Ok(val) -+ } else { -+ ::std::result::Result::Err(self) -+ } -+ } -+ /// Returns true if this is a [`IntegerValue`](crate::types::MyUnion::IntegerValue). -+ pub fn is_integer_value(&self) -> bool { -+ self.as_integer_value().is_ok() -+ } -+ /// Tries to convert the enum instance into [`StringValue`](crate::types::MyUnion::StringValue), extracting the inner [`String`](::std::string::String). -+ /// Returns `Err(&Self)` if it can't be converted. -+ pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> { -+ if let MyUnion::StringValue(val) = &self { -+ ::std::result::Result::Ok(val) -+ } else { -+ ::std::result::Result::Err(self) -+ } -+ } -+ /// Returns true if this is a [`StringValue`](crate::types::MyUnion::StringValue). -+ pub fn is_string_value(&self) -> bool { -+ self.as_string_value().is_ok() -+ } -+ /// Returns true if the enum instance is the `Unknown` variant. -+ pub fn is_unknown(&self) -> bool { -+ matches!(self, Self::Unknown) -+ } -+} -diff --git b/TestModels/Union/runtimes/rust/src/types/simple_union_config.rs a/TestModels/Union/runtimes/rust/src/types/simple_union_config.rs -new file mode 100644 -index 00000000..5aeb72ca ---- /dev/null -+++ a/TestModels/Union/runtimes/rust/src/types/simple_union_config.rs -@@ -0,0 +1,48 @@ -+// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleUnionConfig { -+ // XXX : ::std::option::Option -+} -+ -+impl SimpleUnionConfig { -+ pub fn builder() -> SimpleUnionConfigBuilder { -+ SimpleUnionConfigBuilder::new() -+ } -+} -+ -+#[derive(::std::clone::Clone, ::std::fmt::Debug)] -+pub struct SimpleUnionConfigBuilder { -+ // XXX : ::std::option::Option -+} -+ -+impl SimpleUnionConfigBuilder { -+ /// Creates a new `SimpleUnionConfigBuilder`. -+ pub(crate) fn new() -> Self { -+ Self { -+ // XXX = ::std::option::Option::None -+ // somewhere get default values for things? -+ } -+ } -+ pub fn build( -+ self, -+ ) -> ::std::result::Result -+ { -+ ::std::result::Result::Ok(SimpleUnionConfig {}) -+ } -+ /* -+ 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/Union/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/Union/runtimes/rust/src/implementation_from_dafny.rs index a49d9b049..5ae1a18f0 100644 --- a/TestModels/Union/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/Union/runtimes/rust/src/implementation_from_dafny.rs @@ -11,6 +11,10 @@ pub mod error; pub mod operation; mod conversions; +mod standard_library_conversions; + +#[cfg(feature = "wrapped-client")] +pub mod wrapped; pub use client::Client; pub use types::simple_union_config::SimpleUnionConfig; diff --git a/TestModels/Union/runtimes/rust/src/standard_library_conversions.rs b/TestModels/Union/runtimes/rust/src/standard_library_conversions.rs new file mode 100644 index 000000000..2fec0ffb5 --- /dev/null +++ b/TestModels/Union/runtimes/rust/src/standard_library_conversions.rs @@ -0,0 +1,246 @@ +pub fn ostring_to_dafny( + input: &Option, +) -> ::std::rc::Rc< + 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 {}, +}; + ::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>>, + >, +) -> 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 + } +} + +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 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) +} + +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 + } +} + +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 blob_to_dafny( + input: &::aws_smithy_types::Blob, +) -> ::dafny_runtime::Sequence { + ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) +} + +pub fn oblob_to_dafny( + 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) +} + +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>>, +) -> Option<::aws_smithy_types::Blob> { + 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 odouble_to_dafny( + 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) +} + +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>>, +) -> Option { + 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, +) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { + ::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) +} + +pub fn timestamp_from_dafny( + 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() +} + +pub fn otimestamp_from_dafny( + input: ::std::rc::Rc>>, +) -> Option<::aws_smithy_types::DateTime> { + 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, +) -> Option { + 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, +) -> ::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 {} + ), + } +} + +pub fn result_from_dafny( + 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)), + } +} + +pub fn result_to_dafny( + 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 diff --git a/TestModels/dafny-dependencies/StandardLibrary/Makefile b/TestModels/dafny-dependencies/StandardLibrary/Makefile index 0eabc8d42..bc4acb058 100644 --- a/TestModels/dafny-dependencies/StandardLibrary/Makefile +++ b/TestModels/dafny-dependencies/StandardLibrary/Makefile @@ -38,21 +38,8 @@ polymorph_dotnet : polymorph_java : echo "Skipping polymorph_java for StandardLibrary" -# Using this target for the side-effect of maintaining patches, -# Since Dafny Rust code generation is incomplete and also needs to be patched. -# That only works if you run transpile_rust first. polymorph_rust : - cd $(CODEGEN_CLI_ROOT); \ - $(GRADLEW) run --args="\ - --dafny-version $(DAFNY_VERSION) \ - --library-root $(LIBRARY_ROOT) \ - --patch-files-dir $(if $(DIR_STRUCTURE_V2),$(LIBRARY_ROOT)/codegen-patches/$(SERVICE),$(LIBRARY_ROOT)/codegen-patches) \ - --output-rust $(LIBRARY_ROOT)/runtimes/rust \ - --model $(PROJECT_ROOT)/$(STD_LIBRARY)/Model \ - --namespace aws.polymorph \ - --dependent-model $(PROJECT_ROOT)/$(STD_LIBRARY)/../Model \ - $(POLYMORPH_OPTIONS) \ - "; + echo "Skipping polymorph_rust for StandardLibrary" _polymorph_dependencies: echo "Skipping _polymorph_dependencies for StandardLibrary" @@ -69,6 +56,8 @@ transpile_java: | transpile_implementation_java transpile_test_java # StandardLibrary as a dependency transpile_rust: | transpile_implementation_rust +RUST_OTHER_FILES=runtimes/rust/src/conversion.rs runtimes/rust/src/UTF8_externs.rs + # Override this target to not insert a dependency on the standard library. _mv_implementation_rust: mv implementation_from_dafny-rust/src/implementation_from_dafny.rs runtimes/rust/src/implementation_from_dafny.rs @@ -94,6 +83,7 @@ transpile_implementation: -functionSyntax:3 \ -useRuntimeLib \ $(DAFNY_OPTIONS) \ + $(DAFNY_OTHER_FILES) \ -out $(OUT) # Override SharedMakefile's build_java to not install diff --git a/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/UTF8_externs.rs b/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/UTF8_externs.rs index 4de5cb4e5..eca6a2980 100644 --- a/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/UTF8_externs.rs +++ b/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/UTF8_externs.rs @@ -1,51 +1,67 @@ - // 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>> { - 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 { + 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 { + 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), + }) } - ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Success { value: ::dafny_runtime::Sequence::from_array_owned(_accumulator) }) - } - pub fn Decode(b: &::dafny_runtime::Sequence) -> ::std::rc::Rc, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>> { - let b = String::from_utf8(b.to_array().as_ref().clone()); - match b { + 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 { @@ -60,5 +76,5 @@ impl crate::UTF8::_default { }) } } - } -} \ No newline at end of file + } +} diff --git a/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/conversion.rs b/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/conversion.rs index 978079e17..9fd9446e0 100644 --- a/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/conversion.rs +++ b/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/conversion.rs @@ -78,9 +78,7 @@ pub fn olong_from_dafny(input: ::std::rc::Rc<_Wrappers_Compile::Option>) -> } } -pub fn blob_to_dafny( - input: &::aws_smithy_types::Blob, -) -> ::dafny_runtime::Sequence { +pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { ::dafny_runtime::Sequence::from_array(&input.clone().into_inner()) } @@ -96,13 +94,9 @@ pub fn oblob_to_dafny( ::std::rc::Rc::new(dafny_value) } -pub fn blob_from_dafny( - input: ::dafny_runtime::Sequence, -) -> ::aws_smithy_types::Blob { - +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()), + ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), ) } @@ -116,12 +110,11 @@ pub fn oblob_from_dafny( } } -pub fn double_to_dafny( - input: f64, -) -> ::dafny_runtime::Sequence { +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) + |x| *x, + ) } pub fn odouble_to_dafny( @@ -136,9 +129,7 @@ pub fn odouble_to_dafny( ::std::rc::Rc::new(dafny_value) } -pub fn double_from_dafny( - input: &::dafny_runtime::Sequence, -) -> 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")) } @@ -156,12 +147,16 @@ pub fn odouble_from_dafny( pub fn timestamp_to_dafny( 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<_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>> { +) -> ::std::rc::Rc< + _Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, +> { let dafny_value = match input { Some(f) => _Wrappers_Compile::Option::Some { value: timestamp_to_dafny(*f), @@ -174,15 +169,17 @@ pub fn otimestamp_to_dafny( pub fn timestamp_from_dafny( 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<_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>>, + input: ::std::rc::Rc< + _Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, + >, ) -> Option<::aws_smithy_types::DateTime> { if matches!(input.as_ref(), _Wrappers_Compile::Option::Some { .. }) { Some(timestamp_from_dafny(input.Extract())) @@ -197,7 +194,7 @@ pub fn option_from_dafny( ) -> Option { match &*input { _Wrappers_Compile::Option::Some { value } => Some(converter(value)), - _Wrappers_Compile::Option::None { } => None, + _Wrappers_Compile::Option::None {} => None, } } @@ -206,14 +203,10 @@ pub fn option_to_dafny( converter: fn(&TR) -> T, ) -> ::std::rc::Rc<_Wrappers_Compile::Option> { match input { - Some(value) => ::std::rc::Rc::new( - _Wrappers_Compile::Option::Some { - value: converter(&value) - } - ), - None => ::std::rc::Rc::new( - _Wrappers_Compile::Option::None {} - ), + Some(value) => ::std::rc::Rc::new(_Wrappers_Compile::Option::Some { + value: converter(&value), + }), + None => ::std::rc::Rc::new(_Wrappers_Compile::Option::None {}), } } @@ -234,15 +227,11 @@ pub fn result_to_dafny E, ) -> ::std::rc::Rc<_Wrappers_Compile::Result> { match input { - Ok(value) => ::std::rc::Rc::new( - _Wrappers_Compile::Result::Success { - value: converter_t(&value) - } - ), - Err(error) => ::std::rc::Rc::new( - _Wrappers_Compile::Result::Failure { - error: converter_e(&error) - } - ), + Ok(value) => ::std::rc::Rc::new(_Wrappers_Compile::Result::Success { + value: converter_t(&value), + }), + Err(error) => ::std::rc::Rc::new(_Wrappers_Compile::Result::Failure { + error: converter_e(&error), + }), } -} \ No newline at end of file +} diff --git a/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/implementation_from_dafny.rs b/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/implementation_from_dafny.rs index 3e6599ece..b11c45793 100644 --- a/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/implementation_from_dafny.rs +++ b/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/implementation_from_dafny.rs @@ -1,8 +1,11 @@ #![allow(warnings, unconditional_panic)] #![allow(nonstandard_style)] - +pub mod UTF8_externs; pub mod conversion; -mod UTF8_externs; +pub mod _dafny_externs { + pub use crate::conversion::*; + pub use crate::UTF8_externs::*; +} pub mod r#_Wrappers_Compile { pub use dafny_runtime::DafnyPrint; diff --git a/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/lib.rs b/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/lib.rs deleted file mode 100644 index 12cdf2219..000000000 --- a/TestModels/dafny-dependencies/StandardLibrary/runtimes/rust/src/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[allow(non_snake_case)] -pub mod UTF8; -pub mod conversion; -pub mod implementation_from_dafny; \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java b/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java index 8f8b478d3..1a9cbf47d 100644 --- a/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java +++ b/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java @@ -35,6 +35,18 @@ public class CodegenCli { CodegenCli.class ); + private enum Command { + GENERATE, + PATCH_AFTER_TRANSPILE, + } + + private static final Map optionsForCommand = Map.of( + Command.GENERATE, + getCliOptionsForBuild(), + Command.PATCH_AFTER_TRANSPILE, + getCliOptionsForPatchAfterTranspile() + ); + public static void main(String[] args) { if (args.length == 0 || Arrays.asList(args).contains("-h")) { printHelpMessage(); @@ -127,10 +139,15 @@ public static void main(String[] args) { ); cliArguments.patchFilesDir.ifPresent(engineBuilder::withPatchFilesDir); final CodegenEngine engine = engineBuilder.build(); - engine.run(); + switch (cliArguments.command) { + case GENERATE: + engine.run(); + case PATCH_AFTER_TRANSPILE: + engine.patchAfterTranspiling(); + } } - private static Options getCliOptions() { + private static Options getCliOptionsForBuild() { return new Options() .addOption( Option.builder("h").longOpt("help").desc("print help message").build() @@ -293,11 +310,101 @@ private static Options getCliOptions() { ); } + private static Options getCliOptionsForPatchAfterTranspile() { + return new Options() + .addOption( + Option.builder("h").longOpt("help").desc("print help message").build() + ) + .addOption( + Option + .builder("r") + .longOpt("library-root") + .desc("root directory of the library") + .hasArg() + .required() + .build() + ) + .addOption( + Option + .builder("m") + .longOpt("model") + .desc("directory for the model file[s] (.smithy or json format).") + .hasArg() + .required() + .build() + ) + .addOption( + Option + .builder("d") + .longOpt("dependent-model") + .desc("directory for dependent model file[s] (.smithy format)") + .hasArg() + .required() + .build() + ) + .addOption( + Option + .builder("n") + .longOpt("namespace") + .desc("smithy namespace to generate code for, such as 'com.foo'") + .hasArg() + .required() + .build() + ) + .addOption( + Option + .builder() + .longOpt("output-rust") + .desc(" output directory for generated Rust files") + .hasArg() + .build() + ) + .addOption( + Option + .builder() + .longOpt("dafny-version") + .desc("Dafny version that generated the code to patch") + .hasArg() + .build() + ) + .addOption( + Option + .builder() + .longOpt("aws-sdk") + .desc( + " patch Dafny generated code for AWS SDK-style API and shims" + ) + .build() + ) + .addOption( + Option + .builder() + .longOpt("generate") + .desc( + " optional aspects to generate. Available aspects:\n" + + CodegenEngine.GenerationAspect.helpText() + ) + .hasArgs() + .valueSeparator(',') + .build() + ); + } + private static void printHelpMessage() { - new HelpFormatter().printHelp("smithy-dafny-codegen-cli", getCliOptions()); + new HelpFormatter() + .printHelp( + "smithy-dafny-codegen-cli [generate]", + getCliOptionsForBuild() + ); + new HelpFormatter() + .printHelp( + "smithy-dafny-codegen-cli patch-after-transpile", + getCliOptionsForPatchAfterTranspile() + ); } private record CliArguments( + Command command, Path libraryRoot, Path modelPath, Path[] dependentModelPaths, @@ -324,7 +431,27 @@ private record CliArguments( */ static Optional parse(String[] args) throws ParseException { final DefaultParser parser = new DefaultParser(); - final CommandLine commandLine = parser.parse(getCliOptions(), args); + final String commandString = args.length > 0 && !args[0].startsWith("-") + ? args[0] + : "generate"; + Command command = null; + try { + command = + Command.valueOf(commandString.toUpperCase().replace("-", "_")); + } catch (IllegalArgumentException e) { + LOGGER.error("Unrecognized command: {}", commandString); + printHelpMessage(); + System.exit(-1); + } + + final Options options = optionsForCommand.get(command); + if (options == null) { + LOGGER.error("Unrecognized command: {}", command); + printHelpMessage(); + System.exit(-1); + } + + final CommandLine commandLine = parser.parse(options, args); if (commandLine.hasOption("h")) { printHelpMessage(); return Optional.empty(); @@ -421,6 +548,7 @@ static Optional parse(String[] args) throws ParseException { return Optional.of( new CliArguments( + command, libraryRoot, modelPath, dependentModelPaths, diff --git a/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithyrust/RustTestModels.java b/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithyrust/RustTestModels.java index 01bc7bb0b..dde434c00 100644 --- a/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithyrust/RustTestModels.java +++ b/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithyrust/RustTestModels.java @@ -53,8 +53,8 @@ void testModelsForDotnet(String relativeTestModelPath) { make(testModelPath, "transpile_rust"); make(testModelPath, "polymorph_rust"); make(testModelPath, "test_rust"); - // Since we're checking in and patching code, - // make sure the patch files are up to date. + // Since we're checking in generated (or benerated) code, + // make sure the state matches what's checked in. make(testModelPath, "check_polymorph_diff"); } } 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 599ed4147..e8bfd5ab6 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 @@ -3,6 +3,8 @@ package software.amazon.polymorph; +import static software.amazon.smithy.utils.CaseUtils.toSnakeCase; + import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Streams; @@ -18,10 +20,12 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.OptionalInt; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.stream.IntStream; import java.util.stream.Stream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -771,6 +775,85 @@ private void handlePatching(TargetLanguage targetLanguage, Path outputDir) { } } + public void patchAfterTranspiling() { + for (final TargetLanguage lang : targetLangOutputDirs.keySet()) { + switch (lang) { + case RUST -> patchRustAfterTranspiling(); + default -> {} + } + } + } + + private void patchRustAfterTranspiling() { + final String extraDeclarations = awsSdkStyle + ? extraDeclarationsForSDK() + : extraDeclarationsForLocalService(); + final Path implementationFromDafnyPath = libraryRoot + .resolve("runtimes") + .resolve("rust") + .resolve("src") + .resolve("implementation_from_dafny.rs"); + try { + final List lines = Files.readAllLines( + implementationFromDafnyPath + ); + final int firstModDeclIndex = IntStream + .range(0, lines.size()) + .filter(i -> lines.get(i).trim().startsWith("pub mod")) + .findFirst() + .getAsInt(); + lines.add(firstModDeclIndex, extraDeclarations); + Files.write(implementationFromDafnyPath, lines); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private String extraDeclarationsForSDK() { + return """ + mod client; + mod conversions; + mod standard_library_conversions; + """; + } + + private String extraDeclarationsForLocalService() { + final String configStructName = serviceShape + .expectTrait(LocalServiceTrait.class) + .getConfigId() + .getName(); + final String configSnakeCase = toSnakeCase(configStructName); + + return IOUtils.evalTemplate( + """ + 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; + mod standard_library_conversions; + + #[cfg(feature = "wrapped-client")] + pub mod wrapped; + + pub use client::Client; + pub use types::$configSnakeCase:L::$configStructName:L; + + """, + Map.of( + "configSnakeCase", + configSnakeCase, + "configStructName", + configStructName + ) + ); + } + private String runCommand(Path workingDir, String... args) { List argsList = List.of(args); StringBuilder output = new StringBuilder();