blob: a7cb61393eac1a9515ea8ea9cacec3958c4869ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
use std
use bio
const main = {
var f
var buf : byte[16]
f = bio.mkmem("hello world")
match bio.read(f, buf[:3])
| `std.Ok "hel":
/* ok */
| _:
std.fatal("invalid read from memfile")
;;
match bio.read(f, buf[:])
| `std.Ok "lo world":
/* ok */
| _:
std.fatal("invalid read from memfile")
;;
match bio.read(f, buf[:])
| `std.Err `bio.Eof:
/* ok */
| _:
std.fatal("expected eof in memfile")
;;
}
|