libio: read/write traits from libio not core_io
This commit is contained in:
parent
10cbea72a2
commit
cb3f0a404c
@ -1,4 +1,4 @@
|
|||||||
use {Read, Write};
|
use ::{Read, Write};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Cursor<T> {
|
pub struct Cursor<T> {
|
||||||
@ -50,7 +50,7 @@ impl<T: AsRef<[u8]>> Read for Cursor<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
impl Write for Cursor<&mut [u8]> {
|
||||||
type WriteError = !;
|
type WriteError = !;
|
||||||
type FlushError = !;
|
type FlushError = !;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use byteorder::{ByteOrder, NativeEndian};
|
|||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
|
|
||||||
use core_io::{Read, Write, Error as IoError};
|
use ::{Read, Write, Error as IoError};
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
@ -142,7 +142,7 @@ pub trait ProtoWrite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> ProtoRead for T where T: Read + ?Sized {
|
impl<T> ProtoRead for T where T: Read + ?Sized {
|
||||||
type ReadError = IoError;
|
type ReadError = IoError<T::ReadError>;
|
||||||
|
|
||||||
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Self::ReadError> {
|
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Self::ReadError> {
|
||||||
T::read_exact(self, buf)
|
T::read_exact(self, buf)
|
||||||
@ -150,7 +150,7 @@ impl<T> ProtoRead for T where T: Read + ?Sized {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> ProtoWrite for T where T: Write + ?Sized {
|
impl<T> ProtoWrite for T where T: Write + ?Sized {
|
||||||
type WriteError = IoError;
|
type WriteError = IoError<T::WriteError>;
|
||||||
|
|
||||||
fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::WriteError> {
|
fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::WriteError> {
|
||||||
T::write_all(self, buf)
|
T::write_all(self, buf)
|
||||||
|
Loading…
Reference in New Issue
Block a user