Skip to content

Conversation

Nemo157
Copy link
Member

@Nemo157 Nemo157 commented Nov 25, 2018

Since rust-lang/rust#54383 was merged the Future and Stream traits have become object safe 🎉, here's a test playground showing that Pin<Box<dyn Future>> works.

The only remaining reason for having FutureObj exist is to support storing futures that are being spawned in custom "heap" allocations while keeping Spawn a non-generic trait.

I think StreamObj can probably be dropped, it seems likely that all current use-cases should work fine with using an explicit storage type, Box<dyn Stream>, Pin<Box<dyn Stream>> or SomeCustomHeapStore<dyn Stream> should all work, and if a user does need to be abstract over storage they likely already have some way to do this themselves.

r? @cramertj

@cramertj cramertj merged commit 0f292e7 into rust-lang:master Nov 26, 2018
@Nemo157 Nemo157 deleted the update-future-obj-doc branch November 26, 2018 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants