use std::vec::Vec;
pub use futures_io::{AsyncRead, AsyncWrite, IoVec};
pub use self::allow_std::AllowStdIo;
pub use self::copy_into::CopyInto;
pub use self::flush::Flush;
pub use self::read::Read;
pub use self::read_exact::ReadExact;
pub use self::read_to_end::ReadToEnd;
pub use self::close::Close;
pub use self::split::{ReadHalf, WriteHalf};
pub use self::window::Window;
pub use self::write_all::WriteAll;
mod allow_std;
mod copy_into;
mod flush;
mod read;
mod read_exact;
mod read_to_end;
mod close;
mod split;
mod window;
mod write_all;
pub trait AsyncReadExt: AsyncRead {
fn copy_into<W>(self, writer: W) -> CopyInto<Self, W>
where W: AsyncWrite,
Self: Sized,
{
copy_into::copy_into(self, writer)
}
fn read<T>(self, buf: T) -> Read<Self, T>
where T: AsMut<[u8]>,
Self: Sized,
{
read::read(self, buf)
}
fn read_exact<T>(self, buf: T) -> ReadExact<Self, T>
where T: AsMut<[u8]>,
Self: Sized,
{
read_exact::read_exact(self, buf)
}
fn read_to_end(self, buf: Vec<u8>) -> ReadToEnd<Self>
where Self: Sized,
{
read_to_end::read_to_end(self, buf)
}
fn split(self) -> (ReadHalf<Self>, WriteHalf<Self>)
where Self: AsyncWrite + Sized,
{
split::split(self)
}
}
impl<T: AsyncRead + ?Sized> AsyncReadExt for T {}
pub trait AsyncWriteExt: AsyncWrite {
fn flush(self) -> Flush<Self>
where Self: Sized,
{
flush::flush(self)
}
fn close(self) -> Close<Self>
where Self: Sized,
{
close::close(self)
}
fn write_all<T>(self, buf: T) -> WriteAll<Self, T>
where T: AsRef<[u8]>,
Self: Sized,
{
write_all::write_all(self, buf)
}
}
impl<T: AsyncWrite + ?Sized> AsyncWriteExt for T {}