From 59cf4bc68912e883605a268f681e92e78c1b24e0 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Fri, 27 Aug 2021 15:16:13 +0200 Subject: [PATCH] libboard_zynq: fully modified to work with core_io --- src/libboard_artiq/src/drtioaux.rs | 4 ++-- src/libboard_artiq/src/drtioaux_proto.rs | 12 ++---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/libboard_artiq/src/drtioaux.rs b/src/libboard_artiq/src/drtioaux.rs index 4e3deaaa..78e21f3e 100644 --- a/src/libboard_artiq/src/drtioaux.rs +++ b/src/libboard_artiq/src/drtioaux.rs @@ -1,7 +1,7 @@ use core::slice; use crc; -use core_io::Error as IoError; +use core_io::{ErrorKind as IoErrorKind, Error as IoError}; use io::{proto::ProtoRead, proto::ProtoWrite, Cursor}; use mem::mem::DRTIOAUX_MEM; @@ -84,7 +84,7 @@ pub fn recv(linkno: u8) -> Result, Error> { receive(linkno, |buffer| { if buffer.len() < 8 { - return Err(IoError::UnexpectedEnd.into()) + return Err(IoError::new(IoErrorKind::UnexpectedEof, "Unexpected end").into()) } let mut reader = Cursor::new(buffer); diff --git a/src/libboard_artiq/src/drtioaux_proto.rs b/src/libboard_artiq/src/drtioaux_proto.rs index 53c17458..7d13785d 100644 --- a/src/libboard_artiq/src/drtioaux_proto.rs +++ b/src/libboard_artiq/src/drtioaux_proto.rs @@ -1,6 +1,6 @@ -use core_io::Error as IoError; +use core_io::{Write, Read, Error as IoError}; -use io::proto::{ProtoWrite as Write, ProtoRead as Read}; +use io::proto::{ProtoWrite, ProtoRead}; #[derive(Debug)] pub enum Error { @@ -14,14 +14,6 @@ impl From for Error { } } -/* Why does this not work?! -impl From for Error { - fn from(value: Write::WriteError) -> Error { - Error::Io(value) - } -}*/ - - #[derive(PartialEq, Debug)] pub enum Packet { EchoRequest,