Struct either_future::EitherFuture [−][src]
pub struct EitherFuture<LeftFuture, RightFuture>(_);Implementations
Methods from Deref<Target = Either<LeftFuture, RightFuture>>
Return true if the value is the Left variant.
use either::*;
let values = [Left(1), Right("the right value")];
assert_eq!(values[0].is_left(), true);
assert_eq!(values[1].is_left(), false);Return true if the value is the Right variant.
use either::*;
let values = [Left(1), Right("the right value")];
assert_eq!(values[0].is_right(), false);
assert_eq!(values[1].is_right(), true);Convert &Either<L, R> to Either<&L, &R>.
use either::*;
let left: Either<_, ()> = Left("some value");
assert_eq!(left.as_ref(), Left(&"some value"));
let right: Either<(), _> = Right("some value");
assert_eq!(right.as_ref(), Right(&"some value"));Convert &mut Either<L, R> to Either<&mut L, &mut R>.
use either::*;
fn mutate_left(value: &mut Either<u32, u32>) {
if let Some(l) = value.as_mut().left() {
*l = 999;
}
}
let mut left = Left(123);
let mut right = Right(123);
mutate_left(&mut left);
mutate_left(&mut right);
assert_eq!(left, Left(999));
assert_eq!(right, Right(123));Trait Implementations
impl<LeftFuture, RightFuture> From<Either<LeftFuture, RightFuture>> for EitherFuture<LeftFuture, RightFuture>
impl<LeftFuture, RightFuture> From<Either<LeftFuture, RightFuture>> for EitherFuture<LeftFuture, RightFuture>
impl<Left, Right, LeftFuture, RightFuture> Future for EitherFuture<LeftFuture, RightFuture> where
LeftFuture: Future<Output = Left>,
RightFuture: Future<Output = Right>,
impl<Left, Right, LeftFuture, RightFuture> Future for EitherFuture<LeftFuture, RightFuture> where
LeftFuture: Future<Output = Left>,
RightFuture: Future<Output = Right>,
Auto Trait Implementations
impl<LeftFuture, RightFuture> RefUnwindSafe for EitherFuture<LeftFuture, RightFuture> where
LeftFuture: RefUnwindSafe,
RightFuture: RefUnwindSafe,
impl<LeftFuture, RightFuture> Send for EitherFuture<LeftFuture, RightFuture> where
LeftFuture: Send,
RightFuture: Send,
impl<LeftFuture, RightFuture> Sync for EitherFuture<LeftFuture, RightFuture> where
LeftFuture: Sync,
RightFuture: Sync,
impl<LeftFuture, RightFuture> Unpin for EitherFuture<LeftFuture, RightFuture> where
LeftFuture: Unpin,
RightFuture: Unpin,
impl<LeftFuture, RightFuture> UnwindSafe for EitherFuture<LeftFuture, RightFuture> where
LeftFuture: UnwindSafe,
RightFuture: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (
into_future)The output that the future will produce on completion.
type Future = F
type Future = F
🔬 This is a nightly-only experimental API. (
into_future)Which kind of future are we turning this into?
🔬 This is a nightly-only experimental API. (
into_future)Creates a future from a value.