forked from mirrors/gstreamer-rs
gstreamer: Implement FusedStream
for the Bus
stream
This commit is contained in:
parent
9ee22baa07
commit
08953dfe66
1 changed files with 8 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
use futures_channel::mpsc::{self, UnboundedReceiver};
|
||||
use futures_core::Stream;
|
||||
use futures_util::StreamExt;
|
||||
use futures_util::{stream::FusedStream, StreamExt};
|
||||
use glib::ffi::{gboolean, gpointer};
|
||||
use glib::prelude::*;
|
||||
use glib::source::{Continue, Priority, SourceId};
|
||||
|
@ -295,7 +295,7 @@ impl Bus {
|
|||
pub fn stream_filtered<'a>(
|
||||
&self,
|
||||
message_types: &'a [MessageType],
|
||||
) -> impl Stream<Item = Message> + Unpin + Send + 'a {
|
||||
) -> impl Stream<Item = Message> + Unpin + FusedStream + Send + 'a {
|
||||
self.stream().filter(move |message| {
|
||||
let message_type = message.type_();
|
||||
|
||||
|
@ -359,6 +359,12 @@ impl Stream for BusStream {
|
|||
}
|
||||
}
|
||||
|
||||
impl FusedStream for BusStream {
|
||||
fn is_terminated(&self) -> bool {
|
||||
self.receiver.is_terminated()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in a new issue