Skip to main content

Crate kio

Crate kio 

Source
Expand description

Producer/consumer shared state with async waker-based notification.

This crate provides Producer and Consumer types that share state through a mutex-protected value. Producers can modify the state and consumers are automatically notified via async wakers. The channel auto-closes when all producers are dropped.

For state that both sides legitimately mutate (e.g. a reverse request queue), Shared is a role-less sibling: every handle can lock, read, or park on a predicate, with no liveness of its own.

Queue is a poll-native FIFO queue built in the same style: role-less clone-able handles, bounded or unbounded, with separate wake lists for the push and pop sides.

Fan hands out a Waker that wakes a whole WaiterList, for driving a foreign future that keeps a single waker on behalf of everyone parked on it. It either owns the list or, via Fan::project, wakes one already inside a Lock.

Structs§

Closed
The channel closed before the awaited condition held.
Consumer
The consuming side of a shared state channel.
ConsumerWeak
A weak handle from the consuming side (Consumer::weak).
Fan
A WaiterList that is shared, and that a Waker can wake.
Hold
Defers wakes on a Fan until dropped. Created by Fan::hold.
Lock
A cloneable mutex wrapper backed by Arc<Mutex<T>>.
LockGuard
A guard providing access to the locked value. Releases the lock on drop.
Mut
A mutable guard over the shared state.
Park
Holds a parked Waiter between polls, so the registrations it made outlive the poll that made them.
Pending
Adapts a Pollable into a Future, parking the strong Waiter between polls so its weak registration stays live.
Producer
The producing side of a shared state channel.
ProducerWeak
A weak handle from the producing side (Producer::weak).
Queue
A poll-native FIFO queue with waker notification.
Ref
A read-only guard over the shared state.
Shared
A cloneable, lock-guarded value with waker notification.
Waiter
Handle passed to poll functions for registering with WaiterLists.
WaiterList
A list of weak wakers waiting for notification.
Weak
A handle that owns nothing at all (Producer::downgrade).
WeakLock
A Lock that doesn’t own its value, backed by Weak<Mutex<T>>.

Enums§

PushError
The push failed; the item is handed back.

Traits§

Pollable
A pollable computation backed by kio channels.

Functions§

wait
Create a Future from a poll function that receives a Waiter.