std1.0.0-beta-7 SafeC docs

std :: io_buf

Struct std::BufWriter

#include <std/io_buf.h> source

generic<W: Writer> struct BufWriter {
    &W inner;
    unsigned long len;
    unsigned char buf[IO_BUF_SIZE];
}

Fields

§&W innersource

the stream written to (borrowed)

§unsigned long lensource

bytes waiting in buf

§unsigned char buf[IO_BUF_SIZE]source

Methods

§static struct BufWriter<W> over(&W inner)source · definition
§long long write([]const unsigned char data)source · definition

Writer: takes all of data (into the buffer, or, for a write that doesn't fit, after flushing it, straight to the stream when it is at least IO_BUF_SIZE). data.len, or -1 if the stream failed.

§int flush()source · definition

Flusher: writes out everything buffered. 0 on success, -1 if the stream failed (the buffered bytes are dropped either way).