dope-net 0.30.1

Owned network transports for dope
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::wire::send::{self, Payload};

/// Explicit sum for policies which genuinely return either representation.
pub enum Either<A, B> {
    Left(A),
    Right(B),
}

impl<'a, A: Payload<'a>, B: Payload<'a>> Payload<'a> for Either<A, B> {
    fn select(&self) -> Option<impl send::raw::Ready<'a>> {
        match self {
            Self::Left(data) => data.select().map(Either::Left),
            Self::Right(data) => data.select().map(Either::Right),
        }
    }
}