io #

fn make_reader #

fn make_reader(r Reader) Reader

make_reader is a temp that converts a type to a reader (e.g. for use in struct initialisation) (this shouldnt need to be a thing but until coercion gets made better it is required)

fn make_readerwriter #

fn make_readerwriter(r Reader, w Writer) ReaderWriterImpl

make_readerwriter takes a rstream and a wstream and makes an rwstream with them

fn new_buffered_reader #

fn new_buffered_reader(o BufferedReaderConfig) &BufferedReader

new_buffered_reader creates new BufferedReader

fn read_all #

fn read_all(config ReadAllConfig) ?[]byte

read_all reads all bytes from a reader until either a 0 length read or if read_to_end_of_stream is true then the end of the stream (none)

fn read_any #

fn read_any(r Reader) ?[]byte

read_any reads any available bytes from a reader (until the reader returns a read of 0 length)

interface RandomWriter #

interface RandomWriter {
	write_to(pos u64, buf []byte) ?int

RandomWriter represents a stream of data that can be wrote to at a random pos

interface Reader #

interface Reader {
	read(mut buf []byte) ?int

Reader represents a stream of data that can be read

interface ReaderWriter #

interface ReaderWriter {
	read(mut buf []byte) ?int
	write(buf []byte) ?int

ReaderWriter represents a stream that can be read from and wrote to

interface Writer #

interface Writer {
	write(buf []byte) ?int

Writer represents a stream of data that can be wrote to

fn (BufferedReader) read #

fn (mut r BufferedReader) read(mut buf []byte) ?int

read fufills the Reader interface

fn (BufferedReader) free #

fn (mut r BufferedReader) free()

fn (BufferedReader) end_of_stream #

fn (r BufferedReader) end_of_stream() bool

end_of_stream returns whether the end of the stream was reached

fn (BufferedReader) read_line #

fn (mut r BufferedReader) read_line() ?string

read_line attempts to read a line from the buffered reader it will read until it finds a new line character (\n) or the end of stream

fn (ReaderWriterImpl) read #

fn (mut r ReaderWriterImpl) read(mut buf []byte) ?int

fn (ReaderWriterImpl) write #

fn (mut r ReaderWriterImpl) write(buf []byte) ?int

struct BufferedReaderConfig #

struct BufferedReaderConfig {
	reader  Reader
	cap     int = 128 * 1024
	retries int = 2

BufferedReaderConfig are options that can be given to a reader

struct ReadAllConfig #

struct ReadAllConfig {
	reader                Reader
	read_to_end_of_stream bool

ReadAllConfig allows options to be passed for the behaviour of read_all