diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-04-22 13:10:59 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-04-22 13:11:02 -0700 |
| commit | e5d21b9ff1ea4160b728b62aeca110c0a563d9ee (patch) | |
| tree | 0dade2a5212aadcecc5533b4619f65df2758977e | |
| parent | d0786fdffcbae5c89762455fd3b3ffb5b9a3b6a1 (diff) | |
| download | rust-e5d21b9ff1ea4160b728b62aeca110c0a563d9ee.tar.gz rust-e5d21b9ff1ea4160b728b62aeca110c0a563d9ee.zip | |
core::rt: Make I/O constructors return Option instead of Result
For consistency, for all I/O calls, inspecting the error can be done with the io_error condition.
| -rw-r--r-- | src/libcore/rt/io/file.rs | 2 | ||||
| -rw-r--r-- | src/libcore/rt/io/net/tcp.rs | 4 | ||||
| -rw-r--r-- | src/libcore/rt/io/net/udp.rs | 4 | ||||
| -rw-r--r-- | src/libcore/rt/io/net/unix.rs | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/src/libcore/rt/io/file.rs b/src/libcore/rt/io/file.rs index 4e3e01a5ece..e4fe066a173 100644 --- a/src/libcore/rt/io/file.rs +++ b/src/libcore/rt/io/file.rs @@ -42,7 +42,7 @@ impl FileStream { pub fn open<P: PathLike>(_path: &P, _mode: FileMode, _access: FileAccess - ) -> Result<FileStream, IoError> { + ) -> Option<FileStream> { fail!() } } diff --git a/src/libcore/rt/io/net/tcp.rs b/src/libcore/rt/io/net/tcp.rs index d78241b8e44..d726bae821c 100644 --- a/src/libcore/rt/io/net/tcp.rs +++ b/src/libcore/rt/io/net/tcp.rs @@ -16,7 +16,7 @@ use super::ip::IpAddr; pub struct TcpStream; impl TcpStream { - pub fn connect(_addr: IpAddr) -> Result<TcpStream, IoError> { + pub fn connect(_addr: IpAddr) -> Option<TcpStream> { fail!() } } @@ -40,7 +40,7 @@ impl Close for TcpStream { pub struct TcpListener; impl TcpListener { - pub fn bind(_addr: IpAddr) -> Result<TcpListener, IoError> { + pub fn bind(_addr: IpAddr) -> Option<TcpListener> { fail!() } } diff --git a/src/libcore/rt/io/net/udp.rs b/src/libcore/rt/io/net/udp.rs index 81a6677c14a..8691a697e88 100644 --- a/src/libcore/rt/io/net/udp.rs +++ b/src/libcore/rt/io/net/udp.rs @@ -16,7 +16,7 @@ use super::ip::IpAddr; pub struct UdpStream; impl UdpStream { - pub fn connect(_addr: IpAddr) -> Result<UdpStream, IoError> { + pub fn connect(_addr: IpAddr) -> Option<UdpStream> { fail!() } } @@ -40,7 +40,7 @@ impl Close for UdpStream { pub struct UdpListener; impl UdpListener { - pub fn bind(_addr: IpAddr) -> Result<UdpListener, IoError> { + pub fn bind(_addr: IpAddr) -> Option<UdpListener> { fail!() } } diff --git a/src/libcore/rt/io/net/unix.rs b/src/libcore/rt/io/net/unix.rs index a5f4f8e3ba8..bb3db6ec0d5 100644 --- a/src/libcore/rt/io/net/unix.rs +++ b/src/libcore/rt/io/net/unix.rs @@ -16,7 +16,7 @@ use super::super::support::PathLike; pub struct UnixStream; impl UnixStream { - pub fn connect<P: PathLike>(_path: &P) -> Result<UnixStream, IoError> { + pub fn connect<P: PathLike>(_path: &P) -> Option<UnixStream> { fail!() } } @@ -40,7 +40,7 @@ impl Close for UnixStream { pub struct UnixListener; impl UnixListener { - pub fn bind<P: PathLike>(_path: &P) -> Result<UnixListener, IoError> { + pub fn bind<P: PathLike>(_path: &P) -> Option<UnixListener> { fail!() } } |
