Skip to content

api(oneshot): rename is_closed to is_disconnected in the next breaking release #141

Closed

Description

@tisonkun

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::Disconnected and RecvError::Disconnected describe failed receives
  • mpsc and broadcast likewise use Disconnected for 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:

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_closed to is_disconnected.
  • Rename oneshot::Receiver::is_closed to is_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_disconnected if equivalent predicates are later added to mpsc or broadcast.

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_disconnected on both oneshot endpoints and no longer exposes is_closed.
  • Channel protocol states, error variants, and endpoint predicates use Disconnected consistently.
  • User-facing prose may continue to use “closed channel” where that is clearer English.

Activity

  1. added
    enhancement
    on Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions