forked from M-Labs/artiq
libio: update alloc type path
This commit is contained in:
parent
37ea863004
commit
97a0132f15
|
@ -69,7 +69,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
impl Write for Cursor<::alloc::Vec<u8>> {
|
impl Write for Cursor<::alloc::vec::Vec<u8>> {
|
||||||
type WriteError = !;
|
type WriteError = !;
|
||||||
type FlushError = !;
|
type FlushError = !;
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ impl<'a> Write for &'a mut [u8] {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
impl<'a> Write for alloc::Vec<u8> {
|
impl<'a> Write for alloc::vec::Vec<u8> {
|
||||||
type WriteError = !;
|
type WriteError = !;
|
||||||
type FlushError = !;
|
type FlushError = !;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use {core::str::Utf8Error, alloc::String};
|
use {core::str::Utf8Error, alloc::string::String};
|
||||||
use byteorder::{ByteOrder, NetworkEndian};
|
use byteorder::{ByteOrder, NetworkEndian};
|
||||||
|
|
||||||
use ::{Read, Write, Error as IoError};
|
use ::{Read, Write, Error as IoError};
|
||||||
|
@ -53,7 +53,7 @@ pub trait ProtoRead {
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read_bytes(&mut self) -> Result<::alloc::Vec<u8>, Self::ReadError> {
|
fn read_bytes(&mut self) -> Result<::alloc::vec::Vec<u8>, Self::ReadError> {
|
||||||
let length = self.read_u32()?;
|
let length = self.read_u32()?;
|
||||||
let mut value = vec![0; length as usize];
|
let mut value = vec![0; length as usize];
|
||||||
self.read_exact(&mut value)?;
|
self.read_exact(&mut value)?;
|
||||||
|
@ -62,7 +62,7 @@ pub trait ProtoRead {
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read_string(&mut self) -> Result<::alloc::String, ReadStringError<Self::ReadError>> {
|
fn read_string(&mut self) -> Result<::alloc::string::String, ReadStringError<Self::ReadError>> {
|
||||||
let bytes = self.read_bytes().map_err(ReadStringError::Other)?;
|
let bytes = self.read_bytes().map_err(ReadStringError::Other)?;
|
||||||
String::from_utf8(bytes).map_err(|err| ReadStringError::Utf8(err.utf8_error()))
|
String::from_utf8(bytes).map_err(|err| ReadStringError::Utf8(err.utf8_error()))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue