]> git.lizzy.rs Git - rust.git/commitdiff
Address a few XXX comments throughout the runtime
authorAlex Crichton <alex@alexcrichton.com>
Wed, 16 Oct 2013 03:55:50 +0000 (20:55 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 24 Oct 2013 21:21:56 +0000 (14:21 -0700)
* Implement Seek for Option<Seek>
* Remove outdated comment for io::process
* De-pub a component which didn't need to be pub

src/libstd/rt/io/mod.rs
src/libstd/rt/io/option.rs
src/libstd/rt/io/process.rs

index a80c1aab3988987e8ca9a042c3195ba46dff13ef..a703f9885ac09b98dc1270f87315f6c94fefd2e9 100644 (file)
@@ -332,8 +332,7 @@ pub mod unix { }
 mod mock;
 
 /// The default buffer size for various I/O operations
-/// XXX: Not pub
-pub static DEFAULT_BUF_SIZE: uint = 1024 * 64;
+static DEFAULT_BUF_SIZE: uint = 1024 * 64;
 
 /// The type passed to I/O condition handlers to indicate error
 ///
index 2ea1b6154830a45f3f8742504bd474bc37717174..ecfc4a832bfb5f5ae9d31f842c0e0af21f05a0e4 100644 (file)
 //! I/O constructors return option types to allow errors to be handled.
 //! These implementations allow e.g. `Option<FileStream>` to be used
 //! as a `Reader` without unwrapping the option first.
-//!
-//! # XXX Seek and Close
 
 use option::*;
-use super::{Reader, Writer, Listener, Acceptor};
+use super::{Reader, Writer, Listener, Acceptor, Seek, SeekStyle};
 use super::{standard_error, PreviousIoError, io_error, read_error, IoError};
 
 fn prev_io_error() -> IoError {
@@ -62,6 +60,24 @@ fn eof(&mut self) -> bool {
     }
 }
 
+impl<S: Seek> Seek for Option<S> {
+    fn tell(&self) -> u64 {
+        match *self {
+            Some(ref seeker) => seeker.tell(),
+            None => {
+                io_error::cond.raise(prev_io_error());
+                0
+            }
+        }
+    }
+    fn seek(&mut self, pos: i64, style: SeekStyle) {
+        match *self {
+            Some(ref mut seeker) => seeker.seek(pos, style),
+            None => io_error::cond.raise(prev_io_error())
+        }
+    }
+}
+
 impl<T, A: Acceptor<T>, L: Listener<T, A>> Listener<T, A> for Option<L> {
     fn listen(self) -> Option<A> {
         match self {
index e0ffa82b59fe317f9ccaf9bf2ba69e0171cf8d26..0da9c2166b18dfb753f19e2e22261fd941b38870 100644 (file)
@@ -70,13 +70,6 @@ pub enum StdioContainer {
     /// specified for.
     InheritFd(libc::c_int),
 
-    // XXX: these two shouldn't have libuv-specific implementation details
-
-    /// The specified libuv stream is inherited for the corresponding file
-    /// descriptor it is assigned to.
-    // XXX: this needs to be thought out more.
-    //InheritStream(uv::net::StreamWatcher),
-
     /// Creates a pipe for the specified file descriptor which will be directed
     /// into the previously-initialized pipe passed in.
     ///