use either::Either;
use futures::Sink;
pub use fork::Fork;
mod fork;
pub trait SinkTools<T>: Sink<T> {
fn fork<V, O, F, U>(self, other: O, switch: F) -> Fork<V, Self, O, F, T, U>
where
Self: Sized,
F: FnMut(V) -> Either<T, U>,
O: Sink<U, Error = Self::Error>,
{
Fork::new(self, other, switch)
}
}
impl<T, S: Sink<T>> SinkTools<T> for S {}