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.
This commit is contained in:
parent
d0786fdffc
commit
e5d21b9ff1
4 changed files with 7 additions and 7 deletions
|
|
@ -42,7 +42,7 @@ impl FileStream {
|
|||
pub fn open<P: PathLike>(_path: &P,
|
||||
_mode: FileMode,
|
||||
_access: FileAccess
|
||||
) -> Result<FileStream, IoError> {
|
||||
) -> Option<FileStream> {
|
||||
fail!()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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!()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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!()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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!()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue