Add `CloneableLayer` that can be `Clone`d (#2784)
## Motivation and Context Alternative to #2776, making `Layer` cloneable so it can be stored in a type that implements `Clone`. ## Description In an attempt to reduce struct fields of a service config builder so it only contains `Layer` (plus some exceptions such as `interceptors`), we need to make `Layer` clone since the service config builder `#[derive(Clone)]`. There are two options. One, adopted by this PR, is to have a separate `CloneableLayer` that primarily caters for the need for service config builders. The other option is #2776, where we require that items in `Layer` be `Clone`. Since the latter is rather a sledge hammer, changing the requirement for all of the items to be stored, we will go for the former, which is a more targeted approach and a two-way door if we want to switch to the latter in the future. ## Testing Added unit tests in `type_erase.rs` and `config_bag.rs`. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --------- Co-authored-by:Yuki Saito <awsaito@amazon.com> Co-authored-by:
Zelda Hessler <zhessler@amazon.com>
Loading
Please register or sign in to comment