Repository navigation
Description
Context
Follow-up to #138.
oneshot::Sender::is_closed and oneshot::Receiver::is_closed use closed in their public names, while the channel protocol and public errors use Disconnected:
- the terminal protocol state is
DISCONNECTED TryRecvError::DisconnectedandRecvError::Disconnecteddescribe failed receivesmpscandbroadcastlikewise useDisconnectedfor their channel error variants
This naming was inherited from the upstream oneshot crate, which also exposes is_closed while using disconnected terminology throughout its receive API and implementation.
Repository audit
The two oneshot endpoint methods are currently the only public is_closed predicates in mea. The mpsc and broadcast channels do not expose an equivalent endpoint predicate, so they require no rename, but any future predicate added there should follow the same vocabulary.
Ordinary prose and display strings such as “closed channel” do not need a mechanical rename. The consistency problem is specifically between protocol/API symbols: is_closed versus Disconnected.
Ecosystem comparison
There is no universal Rust channel convention:
- Tokio oneshot and async-channel consistently use
is_closed/Closed. - flume and kanal expose
is_disconnected; flume also usesDisconnectederror variants. - futures oneshot uses
is_canceled/Canceled. std::sync::mpscand crossbeam-channel useDisconnectedfor channel errors.
For mea, is_disconnected is the locally consistent choice because all existing channel error variants already use Disconnected.
Proposed breaking change
- Rename
oneshot::Sender::is_closedtois_disconnected. - Rename
oneshot::Receiver::is_closedtois_disconnected. - Update their documentation to define the exact terminal conditions, especially that a receiver is also terminal after consuming its message.
- Update tests and examples.
- Use
is_disconnectedif equivalent predicates are later added tompscorbroadcast.
If a migration release is published before the next semver-breaking release, add is_disconnected first and deprecate is_closed; remove the deprecated aliases in the breaking release.
Acceptance criteria
- The next semver-breaking release exposes
is_disconnectedon both oneshot endpoints and no longer exposesis_closed. - Channel protocol states, error variants, and endpoint predicates use
Disconnectedconsistently. - User-facing prose may continue to use “closed channel” where that is clearer English.
Activity