aboutsummaryrefslogtreecommitdiffstats
path: root/mumd/src/audio.rs
diff options
context:
space:
mode:
authorEskil Q <eskilq@kth.se>2021-01-02 09:09:27 +0100
committerEskil Q <eskilq@kth.se>2021-01-02 09:09:27 +0100
commitf52329ef65b96d1e5d1fd25dabd51f0fdd23ff92 (patch)
tree76c81f8ea88d3cdf185bea919dd85bf899e81a41 /mumd/src/audio.rs
parent8f212e65f1bc9187ff0854ed0b83e0b25be5847a (diff)
downloadmum-f52329ef65b96d1e5d1fd25dabd51f0fdd23ff92.tar.gz
fix FromStream
Diffstat (limited to 'mumd/src/audio.rs')
-rw-r--r--mumd/src/audio.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/mumd/src/audio.rs b/mumd/src/audio.rs
index 0aae1cf..afe644c 100644
--- a/mumd/src/audio.rs
+++ b/mumd/src/audio.rs
@@ -492,17 +492,15 @@ impl<S> StreamingSignal for FromStream<S>
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Frame> {
let s = self.get_mut();
- match s.next.take() {
- Some(v) => {
- match S::poll_next(Pin::new(&mut s.stream), cx) {
- Poll::Ready(val) => {
- s.next = val;
- Poll::Ready(v)
- }
- Poll::Pending => Poll::Pending
- }
+ if s.next.is_none() {
+ return Poll::Ready(<Self::Frame as Frame>::EQUILIBRIUM);
+ }
+ match S::poll_next(Pin::new(&mut s.stream), cx) {
+ Poll::Ready(val) => {
+ let ret = mem::replace(&mut s.next, val);
+ Poll::Ready(ret.unwrap())
}
- None => Poll::Ready(<Self::Frame as Frame>::EQUILIBRIUM)
+ Poll::Pending => Poll::Pending,
}
}