diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b29c78..4150539 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to `whisk` will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://github.com/AldaronLau/semver). +## [0.13.0] - 2024-06-19 +### Changed + - Switched out `pasts` for `event_iterator` + - Renamed `futures-core` feature to `futures_core_3` + ## [0.12.1] - 2023-06-02 ### Fixed - Weirdness with `Cargo.toml`'s `[[example]]` section and no-std example in CI. diff --git a/Cargo.toml b/Cargo.toml index d8c4b0d..468f8ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ # Whisk -# Copyright © 2022-2023 Jeron Aldaron Lau. +# Copyright © 2022-2024 Jeron Aldaron Lau. # # Licensed under any of: # - Apache License, Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0) @@ -10,7 +10,7 @@ [package] name = "whisk" -version = "0.12.1" +version = "0.13.0" license = "Apache-2.0 OR BSL-1.0 OR MIT" description = "Simple and fast lockless async channels" repository = "https://github.com/ardaku/whisk" @@ -24,24 +24,24 @@ categories = [ "hardware-support", "no-std", ] -keywords = ["channel", "actor", "mpmc", "notifier", "pasts"] +keywords = ["channel", "actor", "mpmc", "notifier", "event_iterator"] readme = "README.md" edition = "2021" rust-version = "1.65" [[example]] name = "tokio" -required-features = ["futures-core"] +required-features = ["futures_core_3"] -[dependencies.futures-core] +[dependencies.futures_core_3] +package = "futures-core" version = "0.3" optional = true default-features = false -[dependencies.pasts] -version = "0.14" +[dependencies.event_iterator] +version = "0.1" optional = true -default-features = false [dev-dependencies] async_main = { version = "0.4", features = ["pasts"] } diff --git a/examples/no-std/Cargo.toml b/examples/no-std/Cargo.toml index 9a01e74..7403eca 100644 --- a/examples/no-std/Cargo.toml +++ b/examples/no-std/Cargo.toml @@ -12,4 +12,4 @@ default-features = false [dependencies.whisk] version = "0.12" -features = ["pasts"] +features = ["event_iterator"] diff --git a/examples/tokio.rs b/examples/tokio.rs index 4b43d1e..38a0322 100644 --- a/examples/tokio.rs +++ b/examples/tokio.rs @@ -4,7 +4,7 @@ use std::{ task::{Context, Poll}, }; -use futures_core::Stream; +use futures_core_3::Stream; use tokio::task; use tokio_stream::StreamExt; use whisk::Channel; diff --git a/src/channel.rs b/src/channel.rs index bbfa2de..61a24dc 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -9,11 +9,11 @@ use crate::{wake_list::WakeHandle, Queue}; /// An MPMC channel with both send and receive capabilities /// -/// Enable the **`futures-core`** feature for `Channel` to implement -/// [`Stream`](futures_core::Stream) (generic `T` must be `Option`). +/// Enable the **`futures_core_3`** feature for `Channel` to implement +/// [`Stream`](futures_core_3::Stream) (generic `T` must be `Option`). /// -/// Enable the **`pasts`** feature for `Channel` to implement -/// [`Notifier`](pasts::Notifier). +/// Enable the **`event_iterator`** feature for `Channel` to implement +/// [`EventIterator`](event_iterator::EventIterator). pub struct Channel(Arc>, WakeHandle); impl Drop for Channel { @@ -89,19 +89,23 @@ impl Future for Channel { } } -#[cfg(feature = "pasts")] -impl pasts::notify::Notify for Channel { - type Event = T; +#[cfg(feature = "event_iterator")] +impl event_iterator::EventIterator for Channel { + type Event<'me> = T where Self: 'me; #[inline(always)] - fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll_next( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll> { let this = self.get_mut(); - this.0.data.take(cx, &mut this.1) + + this.0.data.take(cx, &mut this.1).map(Some) } } -#[cfg(feature = "futures-core")] -impl futures_core::Stream for Channel, U> { +#[cfg(feature = "futures_core_3")] +impl futures_core_3::Stream for Channel, U> { type Item = T; #[inline(always)] diff --git a/src/lib.rs b/src/lib.rs index 93f165d..c2a2214 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,9 +6,10 @@ //! receiver pairs. A [`Channel`] can both send and receive. //! //! # Optional Features -//! - **futures-core**: Implement [`Stream`](futures_core::Stream) for +//! - **futures_core_3**: Implement [`Stream`](futures_core_3::Stream) for //! [`Channel`] (generic `T` must be `Option`) -//! - **pasts**: Implement [`Notifier`](pasts::Notifier) for [`Channel`] +//! - **event_iterator**: Implement +//! [`EventIterator`](event_iterator::EventIterator) for [`Channel`] //! //! # Getting Started //!