moonbitlang/async/pipe does not have a README file

    PipeRead

    type PipeRead

    The read end of a pipe
    impl Reader for PipeRead

    PipeRead::close

    fn PipeRead::close(self : PipeRead) -> Unit

    PipeRead::drop

    async fn PipeRead::drop(self : PipeRead, len : Int) -> Int

    reader.drop(len) drops len number of bytes from the reader. The number of bytes actually dropped is returned. drop will wait until enough number of bytes is available, so the return value would be smaller than len only when EOF is reached.

    PipeRead::fd

    fn PipeRead::fd(self : PipeRead) -> Int

    PipeRead::read

    async fn PipeRead::read(self : PipeRead, dst : FixedArray[Byte], offset? : Int, max_len? : Int) -> Int

    reader.read(dst, offset~, max_len~) read at most max_len bytes from the reader, storing the result in dst[offset:]. The number of bytes actually read is returned. Note that the return value may be smaller than max_len if not enough data is immediately available. If EOF is reached and no more data is available, zero will be returned.

    PipeRead::read_all

    async fn PipeRead::read_all(self : PipeRead) -> &
    Data

    Read all remaining content from the reader. The return value is a &io.Data object, which can be converted to different formats using .binary(), .text() or .json().

    PipeRead::read_exactly

    async fn PipeRead::read_exactly(self : PipeRead, len : Int) -> Bytes

    reader.read_exactly(len) read exactly len number of bytes from the reader. It will wait until enough number of bytes is available. If EOF is reached before enough data is read, ReaderClosed is raised.

    PipeRead::read_some

    async fn PipeRead::read_some(self : PipeRead, max_len? : Int) -> Bytes?

    reader.read_some(max_len?) fetch and return a chunk of data from the reader. It will return as fast as possible when new data become available. If EOF is reached, None is returned.

    If max_len is specified, the returned chunk will not be larger than max_len. Since read_some will return immediately when new data become available, the returned chunk may be smaller than max_len, even if there are still data available in the reader.

    PipeRead::read_until

    async fn PipeRead::read_until(self : PipeRead, sep : StringView) -> String?

    reader.read_until(sep) read UTF-8 encoded text from the input stream until sep or EOF is reached. The segment of input from start of reader to start of sep or EOF is returned. sep will be conusmed from the input, but is not included in the return value.

    PipeWrite

    type PipeWrite

    The write end of a pipe
    impl Writer for PipeWrite

    PipeWrite::close

    fn PipeWrite::close(self : PipeWrite) -> Unit

    PipeWrite::fd

    fn PipeWrite::fd(self : PipeWrite) -> Int

    PipeWrite::write

    async fn PipeWrite::write(self : PipeWrite, data : &
    Data
    ) -> Unit

    PipeWrite::write_once

    async fn PipeWrite::write_once(self : PipeWrite, buf : Bytes, offset~ : Int, len~ : Int) -> Int

    PipeWrite::write_reader

    async fn PipeWrite::write_reader(self : PipeWrite, reader : &
    Reader
    ) -> Unit

    pipe

    fn pipe() -> (PipeRead, PipeWrite) raise

    Create a pipe using pipe(2) system call. Return the read end and write end of the pipe.