diff options
| author | Eskil Q <eskilq@kth.se> | 2021-01-02 08:43:15 +0100 |
|---|---|---|
| committer | Eskil Q <eskilq@kth.se> | 2021-01-02 08:43:15 +0100 |
| commit | ffaa6c3e017e98054f1840d187c10fcdb593b48f (patch) | |
| tree | 5fc4adf05d005a7ad15f44f9dcb9e80571b42fa0 /mumd/src/audio.rs | |
| parent | 5cdac93a475b4402680ac8d274677f4ba29b1e25 (diff) | |
| download | mum-ffaa6c3e017e98054f1840d187c10fcdb593b48f.tar.gz | |
add blanket impl for StreamingSignal
Diffstat (limited to 'mumd/src/audio.rs')
| -rw-r--r-- | mumd/src/audio.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mumd/src/audio.rs b/mumd/src/audio.rs index 324b615..cd6141a 100644 --- a/mumd/src/audio.rs +++ b/mumd/src/audio.rs @@ -433,6 +433,16 @@ trait StreamingSignal { fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Frame>; } +impl<S> StreamingSignal for S + where + S: Signal + Unpin { + type Frame = S::Frame; + + fn poll_next(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Self::Frame> { + Poll::Ready(self.get_mut().next()) + } +} + trait StreamingSignalExt: StreamingSignal { fn next(&mut self) -> Next<'_, Self> { Next { |
