v2 / vlib / io / writer.v
14 lines · 12 sloc · 398 bytes · 21b17fe23419749d568b24a5bc39e6a00cb85eca
Raw
1module io
2
3// Writer is the interface that wraps the `write` method, which
4// writes `buf.len` bytes to the underlying data stream.
5pub interface Writer {
6mut:
7 write(buf []u8) !int
8}
9
10// RandomWriter is the interface that wraps the `write_to` method,
11// which writes `buf.len` bytes to the underlying data stream at a random `pos`.
12pub interface RandomWriter {
13 write_to(pos u64, buf []u8) !int
14}
15