From 976bb5e935fa24a9be102f6b2e04299f8238435f Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 14 May 2018 12:51:44 +0000 Subject: [PATCH] firmware: migrate analyzer_proto to new libio. --- artiq/firmware/libproto/Cargo.toml | 1 + artiq/firmware/libproto/analyzer_proto.rs | 6 +++--- artiq/firmware/libproto/lib.rs | 1 + artiq/firmware/runtime/Cargo.toml | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/artiq/firmware/libproto/Cargo.toml b/artiq/firmware/libproto/Cargo.toml index eb805f1eb..5efb9ce81 100644 --- a/artiq/firmware/libproto/Cargo.toml +++ b/artiq/firmware/libproto/Cargo.toml @@ -11,5 +11,6 @@ path = "lib.rs" byteorder = { version = "1.0", default-features = false } cslice = { version = "0.3" } log = { version = "0.4", default-features = false, optional = true } +io = { path = "../libio", features = ["byteorder"] } std_artiq = { path = "../libstd_artiq", features = ["alloc"] } dyld = { path = "../libdyld" } diff --git a/artiq/firmware/libproto/analyzer_proto.rs b/artiq/firmware/libproto/analyzer_proto.rs index 45153fdd4..66c54c753 100644 --- a/artiq/firmware/libproto/analyzer_proto.rs +++ b/artiq/firmware/libproto/analyzer_proto.rs @@ -1,5 +1,5 @@ -use std::io::{self, Write}; -use WriteExt; +use io::{Write, Result}; +use io::proto::{ProtoWrite}; #[derive(Debug)] pub struct Header { @@ -11,7 +11,7 @@ pub struct Header { } impl Header { - pub fn write_to(&self, writer: &mut Write) -> io::Result<()> { + pub fn write_to(&self, writer: &mut T) -> Result<(), T::WriteError> { writer.write_u32(self.sent_bytes)?; writer.write_u64(self.total_byte_count)?; writer.write_u8(self.overflow_occurred as u8)?; diff --git a/artiq/firmware/libproto/lib.rs b/artiq/firmware/libproto/lib.rs index d3422b5ee..31b8c5d1b 100644 --- a/artiq/firmware/libproto/lib.rs +++ b/artiq/firmware/libproto/lib.rs @@ -6,6 +6,7 @@ extern crate cslice; #[macro_use] extern crate log; +extern crate io; extern crate dyld; extern crate std_artiq as std; diff --git a/artiq/firmware/runtime/Cargo.toml b/artiq/firmware/runtime/Cargo.toml index b7a19a423..ddca4d8a6 100644 --- a/artiq/firmware/runtime/Cargo.toml +++ b/artiq/firmware/runtime/Cargo.toml @@ -19,6 +19,7 @@ cslice = { version = "0.3" } log = { version = "0.4", default-features = false } managed = { version = "0.6", default-features = false, features = ["alloc", "map"] } unwind_backtrace = { path = "../libunwind_backtrace" } +io = { path = "../libio", features = ["std_artiq"] } board = { path = "../libboard", features = ["uart_console", "smoltcp"] } alloc_list = { path = "../liballoc_list" } std_artiq = { path = "../libstd_artiq", features = ["alloc", "io_error_alloc"] }