awslabs / awslabs/aws-sdk-rust

Expose the `CustomizableSend` type in each SDK trait to allow treating operations generically

Open
#987 5 comments 1 reaction 0 assignees View on GitHub
feature-request p3
Dominant language
Rust
Stars
3.3k
Forks
290
Avg merge
1d 12h
Merged PRs (30d)
3

Description

### Describe the feature

I would like to expose the [`CustomizableSend`](https://docs.rs/aws-sdk-dynamodb/latest/src/aws_sdk_dynamodb/client/customize.rs.html#8-13) trait that is used in the bounds of the [`CustomizableOperation::send` call](https://docs.rs/aws-sdk-dynamodb/latest/src/aws_sdk_dynamodb/client/customize.rs.html#106-110) as public.

### Use Case

The reason that I would like to have this trait public, but not implementable is so that I can generically call [`CustomizableOperation::send` call](https://docs.rs/aws-sdk-dynamodb/latest/src/aws_sdk_dynamodb/client/customize.rs.html#106-110) without needing to know the concrete operation types.

For example:

```rust
async fn send_with_interceptor(
operation: CustomizableOperation,
) -> (Result>>, Option)
where
E: Error + Send + Sync + 'static,
B: aws_sdk_dynamodb::client::customize::internal::CustomizableSend,
// fails with "error[E0603]: module `internal` is private"
{
operation
.interceptor(SomeInterceptor)
.send()
.await
}
```

Overall, I would like to be able to do some things with the generic operations, like:
1. Apply an interceptor to the custom operation
2. Call `send()` and `.await` it

### Proposed Solution

I propose that this trait be made public. However, I wouldn't want this trait to be implemented by external crates, so it would be necessary to use a private `Seal` marker trait as a supertrait to prevent that.

### Acknowledgements

- [x] I may be able to implement this feature request (maybe)
- [ ] This feature might incur a breaking change

### A note for the community

### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue, please leave a comment

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked aws-sdk-dynamodb client/customize.rs source, especially CustomizableSend and CustomizableOperation::send, then inspect how the corresponding SDK traits expose these bounds. Done means generic operations can apply an interceptor and await send without concrete operation types, while external crates still cannot implement the public trait.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.