mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
io: fix trait bounds on impl Sink for StreamReader (#6647)
This impl had a bound on `StreamReader<S, E>`; this is incorrect because: - The second generic parameter to `StreamReader` is not an error type; it's a buffer type. - The `Stream` error type in `StreamReader` should not need to be the same as the `Sink` error type. This "passthrough" `Sink` impl was effectively unusable because it required the `Sink` error type be the same as the `StreamReader` buffer type. Resolve this by allowing the `StreamReader` buffer to be anything in this impl.
This commit is contained in:
@@ -326,7 +326,7 @@ impl<S, B> StreamReader<S, B> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: Sink<T, Error = E>, E, T> Sink<T> for StreamReader<S, E> {
|
impl<S: Sink<T, Error = E>, B, E, T> Sink<T> for StreamReader<S, B> {
|
||||||
type Error = E;
|
type Error = E;
|
||||||
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
self.project().inner.poll_ready(cx)
|
self.project().inner.poll_ready(cx)
|
||||||
|
|||||||
Reference in New Issue
Block a user