Skip to content

Add Future::flatten #404

Closed
Closed
@yoshuawuyts

Description

@yoshuawuyts

Similar to future-rs's Future::flatten method, this can sometimes come in useful.

However the only difference with it should be that we take IntoFuture as the trait bound, and call it under the hood. Because IntoFuture is implemented for Future this should work as expected.

Thanks!

Examples

let nested_future = async { async { 1 } };
let future = nested_future.flatten();
assert_eq!(future.await, 1);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions