Skip to content
This repository has been archived by the owner on Dec 9, 2018. It is now read-only.

Commit

Permalink
Losslessly convert from rtio::IoError to io::IoError
Browse files Browse the repository at this point in the history
Closes #5
  • Loading branch information
Jorge Aparicio committed Sep 24, 2014
1 parent ca833d3 commit 0900cfb
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extern crate quickcheck;
extern crate quickcheck_macros;

use native::io::file::FileDesc;
use std::io::{FileAccess, IoError, IoResult, OtherIoError, Read, ReadWrite, Write};
use std::io::{FileAccess, IoError, IoResult, Read, ReadWrite, Write};

use termios::{FAILURE, Termios, SUCCESS};

Expand Down Expand Up @@ -257,12 +257,7 @@ impl SerialPort {
impl Reader for SerialPort {
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
match self.file.inner_read(buf) {
Err(err) => Err(IoError {
// FIXME How to convert rtio::IoError to io::IoError?
desc: "",
detail: err.detail,
kind: OtherIoError,
}),
Err(err) => Err(IoError::from_errno(err.code, true)),
Ok(ret) => Ok(ret),
}
}
Expand All @@ -271,12 +266,7 @@ impl Reader for SerialPort {
impl Writer for SerialPort {
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
match self.file.inner_write(buf) {
Err(err) => Err(IoError {
// FIXME How to convert rtio::IoError to io::IoError?
desc: "",
detail: err.detail,
kind: OtherIoError,
}),
Err(err) => Err(IoError::from_errno(err.code, true)),
Ok(_) => Ok(()),
}
}
Expand Down

0 comments on commit 0900cfb

Please sign in to comment.