Skip to content
This repository has been archived by the owner on Jun 21, 2020. It is now read-only.

Remove StreamObj and use Pin<Box<dyn Stream>> instead #20

Closed
gruberb opened this issue Apr 19, 2019 · 6 comments · Fixed by #23
Closed

Remove StreamObj and use Pin<Box<dyn Stream>> instead #20

gruberb opened this issue Apr 19, 2019 · 6 comments · Fixed by #23

Comments

@gruberb
Copy link

gruberb commented Apr 19, 2019

According to rust-lang/futures-rs#1352, StreamObj is going to be removed in favour for Pin<Box<dyn Stream>>.

type BoxStream<'a, T> = Pin<Box<dyn Stream<Item = T> + Send + 'a>>;

The http-service is using the StreamObj for its Body:
https://github.com/rustasync/http-service/blob/master/src/lib.rs#L29

@gruberb gruberb changed the title Remove Stream and use Pin<Box<dyn Stream>> instead Remove StreamObj and use Pin<Box<dyn Stream>> instead Apr 19, 2019
@Nemo157
Copy link
Contributor

Nemo157 commented Apr 22, 2019

Github won't let me access my fork at the moment ("The backend storage is temporarily offline."), but I prepared a patch to check that the futures change will be a positive here. (The lack of Debug is annoying, but I don't see any easy way around that).

@Kerollmops
Copy link

Kerollmops commented Apr 27, 2019

The StreamObj type has been removed and make tide not able to compile.

I thought the semver rule was to keep the exact specified version of a dependency when talking about pre-release/alpha/beta (i.e. =0.3.0-alpha.14 and not downloading the 0.3.0-alpha.15).

@Nemo157
Copy link
Contributor

Nemo157 commented Apr 27, 2019

=0.3.0-alpha.14 should not download alpha.15, http-service uses 0.3.0-alpha.14 which allows Cargo to install the "semver-compatible" alpha.15. If you want to lock it down with = then that would block it.

It looks like Github has my fork working now, so I can push the patch I prepared and open a PR shortly.

@Kerollmops
Copy link

Kerollmops commented Apr 27, 2019

My only dependency is tide 0.1.1 which directly depends on futures-preview ^0.3.0-alpha.14 and http-service ^0.1.5 which depends on futures-preview ^0.3.0-alpha.14.

In my dependency graph I only have the 0.3.0-alpha.15 version of futures-preview.
I do not write =0.3.0-alpha.14 by hand, would it be possible for the next tide and http-service versions to depend on =0.3.0-alpha.14 to prevent this kind of breaking.

@Nemo157
Copy link
Contributor

Nemo157 commented Apr 27, 2019

@Kerollmops as a workaround for now you can add an explicit futures-preview = "=0.3.0-alpha.14" dependency to your project and Cargo will force everything to use that one version (it doesn't allow multiple semver compatible versions in a build graph).

I'm not directly associated with either project so I can't say whether Tide and http-service want to switch to exact versions to avoid this breakage. I'll leave that for the main devs to answer.

@Kerollmops
Copy link

Wow, did not know that. Thank you! TIL something useful and it work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants