glob
Index
Types
type flags;
type generator;
type pattern;
type strstack;
Errors
type failure;
Functions
fn finish(*generator) void;
fn glob(str, flags...) generator;
fn next(*generator) (str | void | failure);
Types
type flags
type flags = enum uint {
NONE = 0,
MARK = 1,
NOCHECK = 1 << 1,
NOESCAPE = 1 << 2,
NOSORT = 1 << 3,
};
Flags used to control the behavior of next.
type generator
Show undocumented member
type generator = struct {
pats: strstack,
matc: size,
flgs: flags,
tmpp: pattern,
};
type pattern
Show undocumented member
type pattern = struct {
dir: strio::stream,
pat: strio::stream,
rem: strio::stream,
};
type strstack
Show undocumented member
type strstack = struct {
bufv: []strio::stream,
bufc: size,
};
Errors
type failure
type failure = !struct {
path: str,
error: fs::error,
};
Information about an unsuccessful search.
Functions
fn finish
fn finish(gen: *generator) void;
Frees all memory allocated by the generator.
fn glob
fn glob(pattern: str, flags: flags...) generator;
Returns a generator of pathnames matching a pattern. The result must be
freed using finish.
fn next
fn next(gen: *generator) (str | void |
failure);
Returns a generated pathname. The returned string is valid until next
is called again. If, during the search, a directory is encountered that
cannot be opened or read, a failure object is returned instead.
next can be repeatedly called until void is returned.