mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
util: implement Sink
for Either
(#6239)
This commit is contained in:
parent
e7214e3670
commit
53ad102cf0
@ -164,6 +164,39 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<L, R, Item, Error> futures_sink::Sink<Item> for Either<L, R>
|
||||
where
|
||||
L: futures_sink::Sink<Item, Error = Error>,
|
||||
R: futures_sink::Sink<Item, Error = Error>,
|
||||
{
|
||||
type Error = Error;
|
||||
|
||||
fn poll_ready(
|
||||
self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
) -> Poll<std::result::Result<(), Self::Error>> {
|
||||
delegate_call!(self.poll_ready(cx))
|
||||
}
|
||||
|
||||
fn start_send(self: Pin<&mut Self>, item: Item) -> std::result::Result<(), Self::Error> {
|
||||
delegate_call!(self.start_send(item))
|
||||
}
|
||||
|
||||
fn poll_flush(
|
||||
self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
) -> Poll<std::result::Result<(), Self::Error>> {
|
||||
delegate_call!(self.poll_flush(cx))
|
||||
}
|
||||
|
||||
fn poll_close(
|
||||
self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
) -> Poll<std::result::Result<(), Self::Error>> {
|
||||
delegate_call!(self.poll_close(cx))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
Loading…
x
Reference in New Issue
Block a user