Skip to content

Commit

Permalink
impl From for EmscriptenVfsError
Browse files Browse the repository at this point in the history
  • Loading branch information
xmclark committed Mar 27, 2019
1 parent 0740136 commit 18eae44
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/emscripten/src/syscalls/emscripten_vfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ impl EmscriptenVfs {
match self.fd_map.get(&fd) {
Some(FileHandle::Vf(file)) => {
let mut mut_ref = RefCell::borrow_mut(file);
mut_ref
.write_file(buf_slice, 0)
.map_err(|e| EmscriptenVfsError::Io(e))
mut_ref.write_file(buf_slice, 0).into()
}
Some(FileHandle::Socket(host_fd)) => unsafe {
let result = libc::write(*host_fd, buf_slice.as_ptr() as _, count as _);
Expand Down Expand Up @@ -149,3 +147,9 @@ pub enum EmscriptenVfsError {
Errno(errno::Errno),
FileSystemError,
}

impl From<io::Error> for EmscriptenVfsError {
fn from(io_error: io::Error) -> Self {
EmscriptenVfsError::Io(io_error)
}
}

0 comments on commit 18eae44

Please sign in to comment.