]> git.lizzy.rs Git - rust.git/commit
std: Second pass stabilization for `comm`
authorAlex Crichton <alex@alexcrichton.com>
Tue, 23 Dec 2014 19:53:35 +0000 (11:53 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 29 Dec 2014 20:16:49 +0000 (12:16 -0800)
commitbc83a009f655dd3896be4a7cd33cac8032a605f2
tree3acc8533031219690fe14fa56f4427cfa9297296
parentbb8f4fc3b73918abd19d67be702f78e8f73d1874
std: Second pass stabilization for `comm`

This commit is a second pass stabilization for the `std::comm` module,
performing the following actions:

* The entire `std::comm` module was moved under `std::sync::mpsc`. This movement
  reflects that channels are just yet another synchronization primitive, and
  they don't necessarily deserve a special place outside of the other
  concurrency primitives that the standard library offers.
* The `send` and `recv` methods have all been removed.
* The `send_opt` and `recv_opt` methods have been renamed to `send` and `recv`.
  This means that all send/receive operations return a `Result` now indicating
  whether the operation was successful or not.
* The error type of `send` is now a `SendError` to implement a custom error
  message and allow for `unwrap()`. The error type contains an `into_inner`
  method to extract the value.
* The error type of `recv` is now `RecvError` for the same reasons as `send`.
* The `TryRecvError` and `TrySendError` types have had public reexports removed
  of their variants and the variant names have been tweaked with enum
  namespacing rules.
* The `Messages` iterator is renamed to `Iter`

This functionality is now all `#[stable]`:

* `Sender`
* `SyncSender`
* `Receiver`
* `std::sync::mpsc`
* `channel`
* `sync_channel`
* `Iter`
* `Sender::send`
* `Sender::clone`
* `SyncSender::send`
* `SyncSender::try_send`
* `SyncSender::clone`
* `Receiver::recv`
* `Receiver::try_recv`
* `Receiver::iter`
* `SendError`
* `RecvError`
* `TrySendError::{mod, Full, Disconnected}`
* `TryRecvError::{mod, Empty, Disconnected}`
* `SendError::into_inner`
* `TrySendError::into_inner`

This is a breaking change due to the modification of where this module is
located, as well as the changing of the semantics of `send` and `recv`. Most
programs just need to rename imports of `std::comm` to `std::sync::mpsc` and
add calls to `unwrap` after a send or a receive operation.

[breaking-change]
118 files changed:
src/etc/licenseck.py
src/liballoc/arc.rs
src/libcollections/bit.rs
src/librustc_driver/lib.rs
src/librustc_trans/back/write.rs
src/librustc_trans/save/mod.rs
src/librustdoc/test.rs
src/libstd/bitflags.rs
src/libstd/c_str.rs
src/libstd/c_vec.rs
src/libstd/collections/hash/map.rs
src/libstd/comm/blocking.rs [deleted file]
src/libstd/comm/mod.rs [deleted file]
src/libstd/comm/mpsc_queue.rs [deleted file]
src/libstd/comm/oneshot.rs [deleted file]
src/libstd/comm/select.rs [deleted file]
src/libstd/comm/shared.rs [deleted file]
src/libstd/comm/spsc_queue.rs [deleted file]
src/libstd/comm/stream.rs [deleted file]
src/libstd/comm/sync.rs [deleted file]
src/libstd/io/buffered.rs
src/libstd/io/comm_adapters.rs
src/libstd/io/mem.rs
src/libstd/io/net/pipe.rs
src/libstd/io/net/tcp.rs
src/libstd/io/net/udp.rs
src/libstd/io/pipe.rs
src/libstd/io/process.rs
src/libstd/io/stdio.rs
src/libstd/io/timer.rs
src/libstd/io/util.rs
src/libstd/lib.rs
src/libstd/macros.rs
src/libstd/num/f32.rs
src/libstd/num/f64.rs
src/libstd/os.rs
src/libstd/path/posix.rs
src/libstd/path/windows.rs
src/libstd/rand/os.rs
src/libstd/sync/barrier.rs
src/libstd/sync/condvar.rs
src/libstd/sync/future.rs
src/libstd/sync/mod.rs
src/libstd/sync/mpsc/blocking.rs [new file with mode: 0644]
src/libstd/sync/mpsc/mod.rs [new file with mode: 0644]
src/libstd/sync/mpsc/mpsc_queue.rs [new file with mode: 0644]
src/libstd/sync/mpsc/oneshot.rs [new file with mode: 0644]
src/libstd/sync/mpsc/select.rs [new file with mode: 0644]
src/libstd/sync/mpsc/shared.rs [new file with mode: 0644]
src/libstd/sync/mpsc/spsc_queue.rs [new file with mode: 0644]
src/libstd/sync/mpsc/stream.rs [new file with mode: 0644]
src/libstd/sync/mpsc/sync.rs [new file with mode: 0644]
src/libstd/sync/mutex.rs
src/libstd/sync/once.rs
src/libstd/sync/rwlock.rs
src/libstd/sync/semaphore.rs
src/libstd/sync/task_pool.rs
src/libstd/sys/common/helper_thread.rs
src/libstd/sys/unix/process.rs
src/libstd/sys/unix/timer.rs
src/libstd/thread.rs
src/libstd/thread_local/mod.rs
src/libtest/lib.rs
src/test/auxiliary/cci_capture_clause.rs
src/test/compile-fail/bind-by-move-no-guards.rs
src/test/compile-fail/builtin-superkinds-self-type.rs
src/test/compile-fail/comm-not-freeze-receiver.rs
src/test/compile-fail/comm-not-freeze.rs
src/test/compile-fail/issue-12041.rs
src/test/compile-fail/unsendable-class.rs
src/test/run-pass/bool.rs
src/test/run-pass/builtin-superkinds-capabilities-transitive.rs
src/test/run-pass/builtin-superkinds-capabilities-xc.rs
src/test/run-pass/builtin-superkinds-capabilities.rs
src/test/run-pass/builtin-superkinds-self-type.rs
src/test/run-pass/capturing-logging.rs
src/test/run-pass/cci_capture_clause.rs
src/test/run-pass/closure-bounds-can-capture-chan.rs
src/test/run-pass/comm.rs
src/test/run-pass/core-run-destroy.rs
src/test/run-pass/drop-trait-enum.rs
src/test/run-pass/hashmap-memory.rs
src/test/run-pass/issue-13494.rs
src/test/run-pass/issue-3609.rs
src/test/run-pass/issue-4446.rs
src/test/run-pass/issue-4448.rs
src/test/run-pass/issue-8827.rs
src/test/run-pass/issue-9396.rs
src/test/run-pass/ivec-tag.rs
src/test/run-pass/rust-log-filter.rs
src/test/run-pass/send-resource.rs
src/test/run-pass/send-type-inference.rs
src/test/run-pass/sendable-class.rs
src/test/run-pass/spawn-types.rs
src/test/run-pass/task-comm-0.rs
src/test/run-pass/task-comm-10.rs
src/test/run-pass/task-comm-11.rs
src/test/run-pass/task-comm-13.rs
src/test/run-pass/task-comm-14.rs
src/test/run-pass/task-comm-15.rs
src/test/run-pass/task-comm-16.rs
src/test/run-pass/task-comm-3.rs
src/test/run-pass/task-comm-4.rs
src/test/run-pass/task-comm-5.rs
src/test/run-pass/task-comm-6.rs
src/test/run-pass/task-comm-7.rs
src/test/run-pass/task-comm-9.rs
src/test/run-pass/task-comm-chan-nil.rs
src/test/run-pass/task-spawn-move-and-copy.rs
src/test/run-pass/task-stderr.rs
src/test/run-pass/tcp-accept-stress.rs
src/test/run-pass/tcp-connect-timeouts.rs
src/test/run-pass/tempfile.rs
src/test/run-pass/trait-bounds-in-arc.rs
src/test/run-pass/trivial-message.rs
src/test/run-pass/unique-send-2.rs
src/test/run-pass/unique-send.rs
src/test/run-pass/unwind-resource.rs