ref: b2d29ed0eebd0e3e2c162b5e83d6d0e8b6ddee57
dir: /lib/std/diriter.myr/
use "alloc"
use "dir"
use "option"
pkg std =
type diriter = dir#
impl iterable diriter -> byte[:]
const byentry : (d : dir# -> diriter)
;;
const byentry = {d
-> d castto(diriter)
}
impl iterable diriter -> byte[:] =
__iternext__ = {itp, valp
:nextfile
match dirread(itp# castto(dir#))
| `Some ".": goto nextfile
| `Some "..": goto nextfile
| `Some ent:
valp# = ent
-> true
| `None:
-> false
;;
}
__iterfin__ = {itp, valp
std.slfree(valp#)
}
;;