api!: remove Stream implementation for EventEmitter

This commit is contained in:
link2xt
2024-04-19 04:38:42 +00:00
parent d17d89ea8f
commit 72d5a387fb
3 changed files with 1 additions and 19 deletions

1
Cargo.lock generated
View File

@@ -1189,7 +1189,6 @@ dependencies = [
"parking_lot",
"percent-encoding",
"pgp",
"pin-project",
"pretty_assertions",
"pretty_env_logger",
"proptest",

View File

@@ -72,7 +72,6 @@ once_cell = { workspace = true }
percent-encoding = "2.3"
parking_lot = "0.12"
pgp = { version = "0.11", default-features = false }
pin-project = "1"
pretty_env_logger = { version = "0.5", optional = true }
qrcodegen = "1.7.0"
quick-xml = "0.31"

View File

@@ -1,7 +1,6 @@
//! # Events specification.
use async_channel::{self as channel, Receiver, Sender, TrySendError};
use pin_project::pin_project;
pub(crate) mod chatlist_events;
mod payload;
@@ -60,14 +59,10 @@ impl Events {
/// created events emitted by the [`Context`] will only be delivered to one of the
/// `EventEmitter`s.
///
/// The `EventEmitter` is also a [`Stream`], so a typical usage is in a `while let` loop.
///
/// [`Context`]: crate::context::Context
/// [`Context::get_event_emitter`]: crate::context::Context::get_event_emitter
/// [`Stream`]: futures::stream::Stream
#[derive(Debug, Clone)]
#[pin_project]
pub struct EventEmitter(#[pin] Receiver<Event>);
pub struct EventEmitter(Receiver<Event>);
impl EventEmitter {
/// Async recv of an event. Return `None` if the `Sender` has been dropped.
@@ -76,17 +71,6 @@ impl EventEmitter {
}
}
impl futures::stream::Stream for EventEmitter {
type Item = Event;
fn poll_next(
self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
self.project().0.poll_next(cx)
}
}
/// The event emitted by a [`Context`] from an [`EventEmitter`].
///
/// Events are documented on the C/FFI API in `deltachat.h` as `DC_EVENT_*` constants. The