Loading CHANGELOG.next.toml +19 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,25 @@ # references = ["smithy-rs#920"] # meta = { "breaking" = false, "tada" = false, "bug" = false } # author = "rcoh" [[aws-sdk-rust]] message = """ Removed inaccurate log message when a client was used without a sleep implementation, and improved context and call to action in logged messages around missing sleep implementations. """ references = ["aws-sdk-rust#317", "smithy-rs#907"] meta = { "breaking" = false, "tada" = false, "bug" = true } author = "jdisanti" [[smithy-rs]] message = """ Removed spamming log message when a client was used without a sleep implementation, and improved context and call to action in logged messages around missing sleep implementations. """ references = ["aws-sdk-rust#317", "smithy-rs#907"] meta = { "breaking" = false, "tada" = false, "bug" = true } author = "jdisanti" [[aws-sdk-rust]] message = "Use provided `sleep_impl` for retries instead of using Tokio directly." references = ["smithy-rs#923"] Loading codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customizations/SleepImplDecorator.kt +67 −12 Original line number Diff line number Diff line Loading @@ -16,8 +16,10 @@ import software.amazon.smithy.rust.codegen.smithy.generators.config.ServiceConfi /* Example Generated Code */ /* /// Service config. /// pub struct Config { pub(crate) sleep_impl: Option<Arc<dyn AsyncSleep>>, pub(crate) sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>, } impl std::fmt::Debug for Config { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { Loading @@ -26,39 +28,90 @@ impl std::fmt::Debug for Config { } } impl Config { /// Constructs a config builder. pub fn builder() -> Builder { Builder::default() } } /// Builder for creating a `Config`. #[derive(Default)] pub struct Builder { sleep_impl: Option<Arc<dyn AsyncSleep>>, sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>, } impl Builder { /// Constructs a config builder. pub fn new() -> Self { Self::default() } pub fn sleep_impl(mut self, sleep_impl: Arc<dyn AsyncSleep>) -> Self { /// Set the sleep_impl for the builder /// /// # Examples /// /// ```no_run /// use test_smithy_test1832442648477221704::config::Config; /// use aws_smithy_async::rt::sleep::AsyncSleep; /// use aws_smithy_async::rt::sleep::Sleep; /// /// #[derive(Debug)] /// pub struct ForeverSleep; /// /// impl AsyncSleep for ForeverSleep { /// fn sleep(&self, duration: std::time::Duration) -> Sleep { /// Sleep::new(std::future::pending()) /// } /// } /// /// let sleep_impl = std::sync::Arc::new(ForeverSleep); /// let config = Config::builder().sleep_impl(sleep_impl).build(); /// ``` pub fn sleep_impl( mut self, sleep_impl: std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>, ) -> Self { self.set_sleep_impl(Some(sleep_impl)); self } /// Set the sleep_impl for the builder /// /// # Examples /// /// ```no_run /// use test_smithy_test1832442648477221704::config::{Builder, Config}; /// use aws_smithy_async::rt::sleep::AsyncSleep; /// use aws_smithy_async::rt::sleep::Sleep; /// /// #[derive(Debug)] /// pub struct ForeverSleep; /// /// impl AsyncSleep for ForeverSleep { /// fn sleep(&self, duration: std::time::Duration) -> Sleep { /// Sleep::new(std::future::pending()) /// } /// } /// /// fn set_never_ending_sleep_impl(builder: &mut Builder) { /// let sleep_impl = std::sync::Arc::new(ForeverSleep); /// builder.set_sleep_impl(Some(sleep_impl)); /// } /// /// let mut builder = Config::builder(); /// set_never_ending_sleep_impl(&mut builder); /// let config = builder.build(); /// ``` pub fn set_sleep_impl( &mut self, sleep_impl: Option<Arc<dyn AsyncSleep>>, sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>, ) -> &mut Self { self.sleep_impl = sleep_impl; self } /// Builds a [`Config`]. pub fn build(self) -> Config { Config { sleep_impl: self.sleep_impl, sleep_impl: self.sleep_impl } } } #[test] fn test_1() { fn assert_send_sync<T: Send + Sync>() {} assert_send_sync::<Config>(); } */ Loading @@ -77,8 +130,10 @@ class SleepImplDecorator : RustCodegenDecorator { class SleepImplProviderConfig(codegenContext: CodegenContext) : ConfigCustomization() { private val sleepModule = smithyAsyncRtSleep(codegenContext.runtimeConfig) private val moduleUseName = codegenContext.moduleUseName() private val codegenScope = arrayOf("AsyncSleep" to sleepModule.member("AsyncSleep"), "Sleep" to sleepModule.member("Sleep")) private val codegenScope = arrayOf( "AsyncSleep" to sleepModule.member("AsyncSleep"), "Sleep" to sleepModule.member("Sleep"), ) override fun section(section: ServiceConfig) = writable { when (section) { Loading codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/customizations/RetryConfigProviderConfigTest.kt→codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/customizations/RetryConfigDecoratorTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ import software.amazon.smithy.rust.codegen.testutil.rustSettings import software.amazon.smithy.rust.codegen.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.testutil.validateConfigCustomizations internal class RetryConfigProviderConfigTest { internal class RetryConfigDecoratorTest { private val baseModel = """ namespace test use aws.protocols#awsQuery Loading codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/customizations/SleepImplProviderConfigTest.kt→codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/customizations/SleepImplDecoratorTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ import software.amazon.smithy.rust.codegen.testutil.rustSettings import software.amazon.smithy.rust.codegen.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.testutil.validateConfigCustomizations internal class SleepImplProviderConfigTest { internal class SleepImplDecoratorTest { private val baseModel = """ namespace test use aws.protocols#awsQuery Loading codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/customizations/TimeoutConfigProviderConfigTest.kt→codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/customizations/TimeoutConfigDecoratorTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ import software.amazon.smithy.rust.codegen.testutil.rustSettings import software.amazon.smithy.rust.codegen.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.testutil.validateConfigCustomizations internal class TimeoutConfigProviderConfigTest { internal class TimeoutConfigDecoratorTest { private val baseModel = """ namespace test use aws.protocols#awsQuery Loading Loading
CHANGELOG.next.toml +19 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,25 @@ # references = ["smithy-rs#920"] # meta = { "breaking" = false, "tada" = false, "bug" = false } # author = "rcoh" [[aws-sdk-rust]] message = """ Removed inaccurate log message when a client was used without a sleep implementation, and improved context and call to action in logged messages around missing sleep implementations. """ references = ["aws-sdk-rust#317", "smithy-rs#907"] meta = { "breaking" = false, "tada" = false, "bug" = true } author = "jdisanti" [[smithy-rs]] message = """ Removed spamming log message when a client was used without a sleep implementation, and improved context and call to action in logged messages around missing sleep implementations. """ references = ["aws-sdk-rust#317", "smithy-rs#907"] meta = { "breaking" = false, "tada" = false, "bug" = true } author = "jdisanti" [[aws-sdk-rust]] message = "Use provided `sleep_impl` for retries instead of using Tokio directly." references = ["smithy-rs#923"] Loading
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customizations/SleepImplDecorator.kt +67 −12 Original line number Diff line number Diff line Loading @@ -16,8 +16,10 @@ import software.amazon.smithy.rust.codegen.smithy.generators.config.ServiceConfi /* Example Generated Code */ /* /// Service config. /// pub struct Config { pub(crate) sleep_impl: Option<Arc<dyn AsyncSleep>>, pub(crate) sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>, } impl std::fmt::Debug for Config { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { Loading @@ -26,39 +28,90 @@ impl std::fmt::Debug for Config { } } impl Config { /// Constructs a config builder. pub fn builder() -> Builder { Builder::default() } } /// Builder for creating a `Config`. #[derive(Default)] pub struct Builder { sleep_impl: Option<Arc<dyn AsyncSleep>>, sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>, } impl Builder { /// Constructs a config builder. pub fn new() -> Self { Self::default() } pub fn sleep_impl(mut self, sleep_impl: Arc<dyn AsyncSleep>) -> Self { /// Set the sleep_impl for the builder /// /// # Examples /// /// ```no_run /// use test_smithy_test1832442648477221704::config::Config; /// use aws_smithy_async::rt::sleep::AsyncSleep; /// use aws_smithy_async::rt::sleep::Sleep; /// /// #[derive(Debug)] /// pub struct ForeverSleep; /// /// impl AsyncSleep for ForeverSleep { /// fn sleep(&self, duration: std::time::Duration) -> Sleep { /// Sleep::new(std::future::pending()) /// } /// } /// /// let sleep_impl = std::sync::Arc::new(ForeverSleep); /// let config = Config::builder().sleep_impl(sleep_impl).build(); /// ``` pub fn sleep_impl( mut self, sleep_impl: std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>, ) -> Self { self.set_sleep_impl(Some(sleep_impl)); self } /// Set the sleep_impl for the builder /// /// # Examples /// /// ```no_run /// use test_smithy_test1832442648477221704::config::{Builder, Config}; /// use aws_smithy_async::rt::sleep::AsyncSleep; /// use aws_smithy_async::rt::sleep::Sleep; /// /// #[derive(Debug)] /// pub struct ForeverSleep; /// /// impl AsyncSleep for ForeverSleep { /// fn sleep(&self, duration: std::time::Duration) -> Sleep { /// Sleep::new(std::future::pending()) /// } /// } /// /// fn set_never_ending_sleep_impl(builder: &mut Builder) { /// let sleep_impl = std::sync::Arc::new(ForeverSleep); /// builder.set_sleep_impl(Some(sleep_impl)); /// } /// /// let mut builder = Config::builder(); /// set_never_ending_sleep_impl(&mut builder); /// let config = builder.build(); /// ``` pub fn set_sleep_impl( &mut self, sleep_impl: Option<Arc<dyn AsyncSleep>>, sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>, ) -> &mut Self { self.sleep_impl = sleep_impl; self } /// Builds a [`Config`]. pub fn build(self) -> Config { Config { sleep_impl: self.sleep_impl, sleep_impl: self.sleep_impl } } } #[test] fn test_1() { fn assert_send_sync<T: Send + Sync>() {} assert_send_sync::<Config>(); } */ Loading @@ -77,8 +130,10 @@ class SleepImplDecorator : RustCodegenDecorator { class SleepImplProviderConfig(codegenContext: CodegenContext) : ConfigCustomization() { private val sleepModule = smithyAsyncRtSleep(codegenContext.runtimeConfig) private val moduleUseName = codegenContext.moduleUseName() private val codegenScope = arrayOf("AsyncSleep" to sleepModule.member("AsyncSleep"), "Sleep" to sleepModule.member("Sleep")) private val codegenScope = arrayOf( "AsyncSleep" to sleepModule.member("AsyncSleep"), "Sleep" to sleepModule.member("Sleep"), ) override fun section(section: ServiceConfig) = writable { when (section) { Loading
codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/customizations/RetryConfigProviderConfigTest.kt→codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/customizations/RetryConfigDecoratorTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ import software.amazon.smithy.rust.codegen.testutil.rustSettings import software.amazon.smithy.rust.codegen.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.testutil.validateConfigCustomizations internal class RetryConfigProviderConfigTest { internal class RetryConfigDecoratorTest { private val baseModel = """ namespace test use aws.protocols#awsQuery Loading
codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/customizations/SleepImplProviderConfigTest.kt→codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/customizations/SleepImplDecoratorTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ import software.amazon.smithy.rust.codegen.testutil.rustSettings import software.amazon.smithy.rust.codegen.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.testutil.validateConfigCustomizations internal class SleepImplProviderConfigTest { internal class SleepImplDecoratorTest { private val baseModel = """ namespace test use aws.protocols#awsQuery Loading
codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/customizations/TimeoutConfigProviderConfigTest.kt→codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/customizations/TimeoutConfigDecoratorTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ import software.amazon.smithy.rust.codegen.testutil.rustSettings import software.amazon.smithy.rust.codegen.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.testutil.validateConfigCustomizations internal class TimeoutConfigProviderConfigTest { internal class TimeoutConfigDecoratorTest { private val baseModel = """ namespace test use aws.protocols#awsQuery Loading