diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-10-15 20:55:50 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-10-24 14:21:56 -0700 |
| commit | c6fa4e277f5eb873e979d8ac1ae7a4c3ccb1e9cc (patch) | |
| tree | 220d4a4b85d62a84d957a2a05936a9507da1b76d /src/libstd/rt | |
| parent | 1db783bdcf05954e066adf6cefbbc5ac72e13173 (diff) | |
| download | rust-c6fa4e277f5eb873e979d8ac1ae7a4c3ccb1e9cc.tar.gz rust-c6fa4e277f5eb873e979d8ac1ae7a4c3ccb1e9cc.zip | |
Address a few XXX comments throughout the runtime
* Implement Seek for Option<Seek> * Remove outdated comment for io::process * De-pub a component which didn't need to be pub
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/io/mod.rs | 3 | ||||
| -rw-r--r-- | src/libstd/rt/io/option.rs | 22 | ||||
| -rw-r--r-- | src/libstd/rt/io/process.rs | 7 |
3 files changed, 20 insertions, 12 deletions
diff --git a/src/libstd/rt/io/mod.rs b/src/libstd/rt/io/mod.rs index a80c1aab398..a703f9885ac 100644 --- a/src/libstd/rt/io/mod.rs +++ b/src/libstd/rt/io/mod.rs @@ -332,8 +332,7 @@ pub mod native { 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 /// diff --git a/src/libstd/rt/io/option.rs b/src/libstd/rt/io/option.rs index 2ea1b615483..ecfc4a832bf 100644 --- a/src/libstd/rt/io/option.rs +++ b/src/libstd/rt/io/option.rs @@ -13,11 +13,9 @@ //! 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 @@ impl<R: Reader> Reader for Option<R> { } } +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 { diff --git a/src/libstd/rt/io/process.rs b/src/libstd/rt/io/process.rs index e0ffa82b59f..0da9c2166b1 100644 --- a/src/libstd/rt/io/process.rs +++ b/src/libstd/rt/io/process.rs @@ -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. /// |
