-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaking changes before releasing crossbeam-channel 1.0 #256
Comments
Change the signature of The interface of
See also: #245 (comment) |
Use the word "closed" instead of "disconnected". That means we'd rename variants like Prior art:
See also: rust-lang/futures-rs#1346 |
Not a breaking change, but a new feature. Add methods See also: #236 |
Not a breaking change, but a new feature. Add methods |
@stjepang I'm sure not if you want to keep this as a meta issue or also discuss in it, but here are some of my toughs. Regarding the use of a token/index in I'm also against adding |
@Thomasdezeeuw Thank you for weighing in! Yes, I'm still keeping this meta-issue so that we don't forget about anything that needs another careful look before stabilization. I'd be happy with I'm increasingly feeling |
Not a breaking change, but a small API addition: impl<T> Sender<T> {
fn connected_to(&self, r: &Receiver<T>) -> bool;
}
impl<T> Receiver<T> {
fn connected_to(&self, s: &Sender<T>) -> bool;
} These methods check whether a sender and a receiver belong to the same channel. |
An idea by @mgeier: Make enum RecvError {
Closed,
}
enum SendError<T> {
Closed(T),
} |
Another idea by @mgeier: Rename enum RecvTimeoutError {
Empty,
Closed,
}
enum SendTimeoutError<T> {
Full(T),
Closed(T),
} |
I just realized why "disconnect" might be preferable to "close". When we "close" a Unix pipe or a channel in other programming languages, the handle is not dropped. That means one can do: chan.close();
chan.send(foo); // this will panic, abort, or throw an exception In Rust this is not possible. In fact, once all senders or all receivers get dropped, the channel is really "disconnected" because we literally don't have a sender handle connected to a receiver handle anymore. Moreover, closing tends to be a manual action you have to explicitly request, whereas disconnection tends to be an automatic action. Does this make sense to anyone? |
In early 2019, I'd like to publish version 1.0 of
crossbeam-channel
.This issue tracks potential breaking changes for the final release.
Please vote on suggestions with 👍 and 👎, or write a comment.
The text was updated successfully, but these errors were encountered: