struct ArgIteratorPosix [src]
Fields
index: usize
count: usize
Members
Source
pub const ArgIteratorPosix = struct {
index: usize,
count: usize,
pub const InitError = error{};
pub fn init() ArgIteratorPosix {
return ArgIteratorPosix{
.index = 0,
.count = std.os.argv.len,
};
}
pub fn next(self: *ArgIteratorPosix) ?[:0]const u8 {
if (self.index == self.count) return null;
const s = std.os.argv[self.index];
self.index += 1;
return mem.sliceTo(s, 0);
}
pub fn skip(self: *ArgIteratorPosix) bool {
if (self.index == self.count) return false;
self.index += 1;
return true;
}
}