Skip to content

Client::send() should return a lazy future, not an outer code #14

Closed
@daniel-abramov

Description

@daniel-abramov

The example of fcm-rust usage from docs shows that the one is expected to use futures::future::lazy() to prepare a future which can then be spawned, however it's hardly possible in a real backend code as the Client is not Clone, i.e. each time when the user wants to spawn a notification, the whole hyper::Client will have to be moved inside the future for just one request.

It does not make sense to clone Client though as that would probably be too expensive, so if we want to return a "just a future" which makes the job done, it would make sense to wrap the future which the Client returns into Lazy inside the implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions