Skip to content
Unverified Commit 7ed51b21 authored by ysaito1001's avatar ysaito1001 Committed by GitHub
Browse files

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: default avatarYuki Saito <awsaito@amazon.com>
Co-authored-by: default avatarZelda Hessler <zhessler@amazon.com>
parent d5a315fa
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment