Skip to content

storage: template-based stub makes it hard to create a generic type holding a Storage #3663

@mincrmatt12

Description

@mincrmatt12

The Storage client type takes a generic for its stub implementation, which is well-documented. However, the default implementation used for the real client doesn't seem to be nameable outside the crate, and so one can't define a type holding a Storage like

struct App<
   StorStub = google_cloud_storage::storage::transport::Storage
> where StorStub: google_cloud_storage::stub::Storage + 'static
{
    // ...
    storage: Storage<StorStub>
}

Specifically, you can't give the correct default and thus can't do something like a MockableApp<StorStub> with the real application using a type App = MockableApp<gcs::storage::transport::Storage>. It then becomes very hard to send that application state around anything long-lived, because you can't rely on type inference to solve the problem.

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions