Comments (14)
FWIW, a not unified output would have been more powerful because you can always call into_inner
if they end up being the same type.
Not sure if you ever plan on doing 2.0 but that could be a consideration :)
from either.
Is there a reason you're not using futures::future::Either
for that?
from either.
Is there a reason you're not using
futures::future::Either
for that?
I guess we could yeah! I'll try and report back.
from either.
It doesn't work at the moment because project
is not exposed publicly. However, I think from the previous responses, people are okay with adding it so I'll submit a PR now.
Edit: PR submitted here: rust-lang/futures-rs#2691
from either.
Another thing I just discovered is that futures::Either
has a - IMO - very weird implementation of Future
:
impl<A, B> Future for Either<A, B>
where
A: Future,
B: Future<Output = A::Output>,
{
type Output = A::Output;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
match self.project() {
Either::Left(x) => x.poll(cx),
Either::Right(x) => x.poll(cx),
}
}
}
I would have expected that a Either<F1, F2>
yields me another Either
type but the implementation in futures
forces both futures to resolve to the same type.
from either.
Would you be up for merging an implementation of the futures
traits that doesn't try to be clever and simply sets all associated types to Either
, i.e. Future::Output
, Stream::Item
, etc
from either.
Ah, note that Future
is a re-export from core
, and #77 already implemented that with a unified Output
. I'm not sure why I did that -- probably just because that's how we treat Iterator
too.
from either.
Ah, note that
Future
is a re-export fromcore
, and #77 already implemented that with a unifiedOutput
. I'm not sure why I did that -- probably just because that's how we treatIterator
too.
Dang so that would be a breaking change :(
I guess I'll have to stick with my custom Either
type then.
from either.
Related Issues (20)
- Either::as_ref method HOT 5
- Alternative `Deref` implementations HOT 1
- Implement From<L> and From<R> for Either<L, R> HOT 11
- implement `IntoIterator` HOT 1
- rustc warning: trait objects without an explicit `dyn` are deprecated HOT 2
- Impl Tokio traits for Either? HOT 2
- Add some examples/rationale at the top of the documentation *why* one might want to use Either and what for HOT 4
- set serde derive to use serde untagged HOT 6
- serde_untagged_optional doesn't handle when field does not exist. HOT 2
- Unable to use "either::serde_untagged", instructions unclear HOT 2
- Use Github Actions for CI
- Publicly expose the `either!` macro? HOT 5
- Trait to add `right_or(Left)` to `Option<Right>`. HOT 2
- Provide "into-common-type" function HOT 1
- Missing rfold and nth_back specializations on DoubleEndedIterator impl
- Bring `std::error::Error` implementation up to latest version HOT 2
- Allow pin projection HOT 13
- Implement `bimap` which combines `left_map` and `right_map` HOT 2
- Add `flatten`, `flatten_right` and `flatten_left` methods HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from either.