rust/src/libstd
bors 17af6f7d0c auto merge of #10688 : bjz/rust/recv_iter, r=brson
I've noticed I use this pattern quite a bit:

~~~rust
do spawn {
    loop {
        match port.try_recv() {
            Some(x) => ...,
            None => ...,
        }
    }
}
~~~

The `RecvIterator`, returned from a default `recv_iter` method on the `GenericPort` trait, allows you to reduce this down to:

~~~rust
do spawn {
    for x in port.recv_iter() {
        ...
    }
}
~~~

As demonstrated in the tests, you can also access the port from within the `for` block for further `recv`ing and `peek`ing with no borrow errors, which is quite nice.
2013-11-27 01:52:10 -08:00
..
fmt libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
io libstd: Fix Win32 and other bustage. 2013-11-26 08:25:27 -08:00
num libstd: Fix Win32 and other bustage. 2013-11-26 08:25:27 -08:00
path test: Remove non-procedure uses of do from compiletest, libstd tests, 2013-11-26 08:25:27 -08:00
rand libstd: Fix Win32 and other bustage. 2013-11-26 08:25:27 -08:00
rt auto merge of #10312 : thestinger/rust/thread_local, r=alexcritchton 2013-11-26 13:32:43 -08:00
task librustc: Make || lambdas not infer to procs 2013-11-26 08:25:27 -08:00
unstable librustc: Fix merge fallout. 2013-11-26 11:04:39 -08:00
any.rs Fix path parsing 2013-11-11 21:53:14 +09:00
ascii.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
at_vec.rs test: Remove non-procedure uses of do from compiletest, libstd tests, 2013-11-26 08:25:27 -08:00
bool.rs test: Remove non-procedure uses of do from compiletest, libstd tests, 2013-11-26 08:25:27 -08:00
borrow.rs std::borrow: Use raw pointer comparison for ref_eq 2013-09-18 06:05:06 +02:00
c_str.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
cast.rs remove cast::unsafe_copy 2013-11-14 22:20:12 -05:00
cell.rs test: Remove non-procedure uses of do from compiletest, libstd tests, 2013-11-26 08:25:27 -08:00
char.rs test: Remove non-procedure uses of do from compiletest, libstd tests, 2013-11-26 08:25:27 -08:00
cleanup.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
clone.rs make DeepClone inherit from Clone 2013-11-08 23:26:53 -05:00
cmp.rs Now inline default 'ne' methods 2013-08-30 22:02:24 -04:00
comm.rs Add an iterator for receiving messages from GenericPorts 2013-11-27 15:10:12 +10:00
condition.rs libstd: Fix Win32 and other bustage. 2013-11-26 08:25:27 -08:00
container.rs container: inline contains_key default method 2013-08-20 22:05:03 -04:00
default.rs std: Add a bunch of Default impls 2013-09-12 18:54:13 -07:00
either.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
from_str.rs Add from_str docs 2013-09-05 00:58:12 -04:00
gc.rs libstd: Fix Win32 and other bustage. 2013-11-26 08:25:27 -08:00
hash.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
hashmap.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
iter.rs test: Remove non-procedure uses of do from compiletest, libstd tests, 2013-11-26 08:25:27 -08:00
kinds.rs kinds: update documentation 2013-08-15 21:12:34 -04:00
lib.rs Remove unused std::routine 2013-11-26 15:19:41 -08:00
libc.rs std::libc: Simplify win32/win64 type definitions 2013-11-24 19:08:41 +09:00
local_data.rs test: Remove non-procedure uses of do from compiletest, libstd tests, 2013-11-26 08:25:27 -08:00
logging.rs Cache a task's stderr logger 2013-11-24 21:22:19 -08:00
managed.rs Fix an off-by-one in managed::refcount 2013-10-18 09:33:18 -07:00
mem.rs Cleaned, documented, wrote tests for up std::bool 2013-10-24 17:21:39 +02:00
ops.rs libstd: Fix Win32 and other bustage. 2013-11-26 08:25:27 -08:00
option.rs test: Remove non-procedure uses of do from compiletest, libstd tests, 2013-11-26 08:25:27 -08:00
os.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
owned.rs std: implement Total{Ord,Eq} for pointers. 2013-08-04 19:46:52 +10:00
prelude.rs Introduce an io::Buffer trait 2013-11-13 11:36:13 -08:00
ptr.rs test: Remove non-procedure uses of do from compiletest, libstd tests, 2013-11-26 08:25:27 -08:00
rc.rs librustc: Fix merge fallout. 2013-11-26 11:04:39 -08:00
reflect.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
repr.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
result.rs test: Remove non-procedure uses of do from compiletest, libstd tests, 2013-11-26 08:25:27 -08:00
run.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
select.rs librustc: Fix merge fallout. 2013-11-26 11:04:39 -08:00
send_str.rs Implemented IntoSendStr on SendStr to allow naming a 2013-10-05 21:28:04 +02:00
str.rs test: Remove non-procedure uses of do from compiletest, libstd tests, 2013-11-26 08:25:27 -08:00
to_bytes.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
to_str.rs std: Remove usage of fmt! 2013-09-30 23:21:18 -07:00
trie.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
tuple.rs std: Replace CloneableTuple with Tuple, which takes self by-val. 2013-09-25 19:00:08 +10:00
unicode.rs libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
unit.rs Reordered the methods in std::Option and std::Result 2013-11-01 15:00:46 +01:00
util.rs test: Remove non-procedure uses of do from compiletest, libstd tests, 2013-11-26 08:25:27 -08:00
vec.rs librustc: Fix merge fallout. 2013-11-26 11:04:39 -08:00