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:
Eric Seppanen 2024-06-21 06:00:33 -07:00 committed by GitHub
parent 9a75d6f7f7
commit ed4ddf443d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.project().inner.poll_ready(cx)