Skip to content

🚸 Various improvements to notified API#219

Merged
zeenix merged 7 commits intoz-galaxy:mainfrom
zeenix:notified-api-improvements
Jan 31, 2026
Merged

🚸 Various improvements to notified API#219
zeenix merged 7 commits intoz-galaxy:mainfrom
zeenix:notified-api-improvements

Conversation

@zeenix
Copy link
Collaborator

@zeenix zeenix commented Jan 31, 2026

  • ✨ smol,tokio: notified::Stream now handles notified::State drop
  • ➕ tokio: Add direct dep on pin-project-lite
  • 🏗️ smol,tokio: Use pin-project-lite to consolidate notified
  • ✨ smol,tokio: Split stream types for notified
  • ♻️ smol,tokio: Split notified module into a hierarchy
  • 🚩 smol,tokio: notified now gated behind server feature
  • 🏗️ core: Provide traits for notified API

Fixes #86.

When the `State` is dropped, all the receiving streams now send out the
last known value with `continues=false` before yielding a `None`.

This implies that we now require `Unpin` on the underlying type in case
of `tokio`. Although this is not a big issue (since most types are
`Unpin`), we'll still try to remove this requirement in a following
commit.

Partially fixes z-galaxy#86.
It's already an indirect dep through zlink-core.
Benefits:

* Avoids allocations.
* Remove `Unpin` requirement on `T` in `State<T>` that was introduced in
  a previous commit (50ff547).
This allows us to drop the `Clone` requirement on `T` for `Once`.

Fixes z-galaxy#86.
These APIs are targeted for server impls so this makes sense.
The actual impl comes from the runtime crates but we now put the
interface in -core to ensure our API is always consistent.
@zeenix zeenix enabled auto-merge January 31, 2026 17:26
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 31, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks


Comparing zeenix:notified-api-improvements (75385a2) with main (0c6afab)

Open in CodSpeed

@zeenix zeenix merged commit 1c6fc05 into z-galaxy:main Jan 31, 2026
15 checks passed
@zeenix zeenix deleted the notified-api-improvements branch January 31, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve notified implementation with better lifecycle management

1 participant