ref: 3af73a7086c91dd6b94b5407081e4a9c80014a5b
dir: /lib/std/readall.myr/
use "errno" use "result" use "option" use "syswrap" use "types" pkg std = const readall : (fd : fd, dst : byte[:] -> result(size, errno)) ;; const readall = {fd, dst var sz sz = dst.len while dst.len != 0 match std.read(fd, dst) | `Ok 0: break | `Ok n: dst = dst[n:] | `Fail e: -> `Fail e ;; ;; -> `Ok sz - dst.len }