fix memstream impl
This commit is contained in:
parent
de17c738d2
commit
2650a96d16
1 changed files with 1 additions and 5 deletions
4
src/cache/mod.rs
vendored
4
src/cache/mod.rs
vendored
|
@ -188,13 +188,9 @@ impl Stream for MemStream {
|
||||||
fn poll_next(mut self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
fn poll_next(mut self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||||
let mut new_bytes = Bytes::new();
|
let mut new_bytes = Bytes::new();
|
||||||
std::mem::swap(&mut self.0, &mut new_bytes);
|
std::mem::swap(&mut self.0, &mut new_bytes);
|
||||||
if new_bytes.is_empty() {
|
|
||||||
Poll::Ready(None)
|
|
||||||
} else {
|
|
||||||
Poll::Ready(Some(Ok(new_bytes)))
|
Poll::Ready(Some(Ok(new_bytes)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
Loading…
Reference in a new issue