#[cfg(doc)]
use std::io::ErrorKind;
use completion_io::AsyncBufRead;
use super::extend_lifetime_mut;
#[cfg(test)]
use super::test_utils;
mod take_until;
pub use take_until::*;
mod read_until;
pub use read_until::ReadUntil;
mod read_line;
pub use read_line::ReadLine;
mod split;
pub use split::Split;
mod lines;
pub use lines::Lines;
pub trait AsyncBufReadExt: AsyncBufRead {
fn take_until(self, delim: u8) -> TakeUntil<Self>
where
Self: Sized,
{
TakeUntil::new(self, delim)
}
fn read_until<'a>(&'a mut self, delim: u8, buf: &'a mut Vec<u8>) -> ReadUntil<'a, Self> {
ReadUntil::new(self, delim, buf)
}
fn read_line<'a>(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self> {
ReadLine::new(self, buf)
}
fn split<'r>(self, byte: u8) -> Split<'r, Self>
where
Self: Sized + 'r,
{
Split::new(self, byte)
}
fn lines<'r>(self) -> Lines<'r, Self>
where
Self: Sized + 'r,
{
Lines::new(self)
}
}
impl<T: AsyncBufRead + ?Sized> AsyncBufReadExt for T {}