Skip to content

Commit b4ccd5d

Browse files
committed
---
yaml --- r: 144905 b: refs/heads/try2 c: 8f0721b h: refs/heads/master i: 144903: af8ec34 v: v3
1 parent 09dd7ca commit b4ccd5d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: ed695d470bf1568b896f2944815f4723905ab66e
8+
refs/heads/try2: 8f0721bcb86c0aa236991118d65639cc4f2f8ea4
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/rt/io/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,21 +493,26 @@ pub trait Acceptor<T> {
493493
/// then `accept` returns `None`.
494494
fn accept(&mut self) -> Option<T>;
495495

496-
/// Create an iterator over incoming connections
496+
/// Create an iterator over incoming connection attempts
497497
fn incoming<'r>(&'r mut self) -> IncomingIterator<'r, Self> {
498498
IncomingIterator { inc: self }
499499
}
500500
}
501501

502502
/// An infinite iterator over incoming connection attempts.
503503
/// Calling `next` will block the task until a connection is attempted.
504+
///
505+
/// Since connection attempts can continue forever, this iterator always returns Some.
506+
/// The Some contains another Option representing whether the connection attempt was succesful.
507+
/// A successful connection will be wrapped in Some.
508+
/// A failed connection is represented as a None and raises a condition.
504509
struct IncomingIterator<'self, A> {
505510
priv inc: &'self mut A,
506511
}
507512

508-
impl<'self, T, A: Acceptor<T>> Iterator<T> for IncomingIterator<'self, A> {
509-
fn next(&mut self) -> Option<T> {
510-
self.inc.accept()
513+
impl<'self, T, A: Acceptor<T>> Iterator<Option<T>> for IncomingIterator<'self, A> {
514+
fn next(&mut self) -> Option<Option<T>> {
515+
Some(self.inc.accept())
511516
}
512517
}
513518

0 commit comments

Comments
 (0)