summaryrefslogtreecommitdiff
path: root/src/streaming.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/streaming.zig')
-rw-r--r--src/streaming.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/streaming.zig b/src/streaming.zig
index cc5da79..7bdc71f 100644
--- a/src/streaming.zig
+++ b/src/streaming.zig
@@ -28,7 +28,7 @@ pub fn Arg(comptime Id: type) type {
28/// A command line argument parser which, given an ::ArgIterator, will parse arguments according 28/// A command line argument parser which, given an ::ArgIterator, will parse arguments according
29/// to the ::params. ::StreamingClap parses in an iterating manner, so you have to use a loop together with 29/// to the ::params. ::StreamingClap parses in an iterating manner, so you have to use a loop together with
30/// ::StreamingClap.next to parse all the arguments of your program. 30/// ::StreamingClap.next to parse all the arguments of your program.
31pub fn StreamingClap(comptime Id: type, comptime ArgError: type) type { 31pub fn StreamingClap(comptime Id: type, comptime ArgIterator: type) type {
32 return struct { 32 return struct {
33 const State = union(enum) { 33 const State = union(enum) {
34 Normal, 34 Normal,
@@ -41,10 +41,10 @@ pub fn StreamingClap(comptime Id: type, comptime ArgError: type) type {
41 }; 41 };
42 42
43 params: []const clap.Param(Id), 43 params: []const clap.Param(Id),
44 iter: *args.Iterator(ArgError), 44 iter: *ArgIterator,
45 state: State, 45 state: State,
46 46
47 pub fn init(params: []const clap.Param(Id), iter: *args.Iterator(ArgError)) @This() { 47 pub fn init(params: []const clap.Param(Id), iter: *ArgIterator) @This() {
48 var res = @This(){ 48 var res = @This(){
49 .params = params, 49 .params = params,
50 .iter = iter, 50 .iter = iter,
@@ -189,8 +189,8 @@ pub fn StreamingClap(comptime Id: type, comptime ArgError: type) type {
189} 189}
190 190
191fn testNoErr(params: []const clap.Param(u8), args_strings: []const []const u8, results: []const Arg(u8)) void { 191fn testNoErr(params: []const clap.Param(u8), args_strings: []const []const u8, results: []const Arg(u8)) void {
192 var arg_iter = args.SliceIterator.init(args_strings); 192 var iter = args.SliceIterator.init(args_strings);
193 var c = StreamingClap(u8, args.SliceIterator.Error).init(params, &arg_iter.iter); 193 var c = StreamingClap(u8, args.SliceIterator).init(params, &iter);
194 194
195 for (results) |res| { 195 for (results) |res| {
196 const arg = (c.next() catch unreachable) orelse unreachable; 196 const arg = (c.next() catch unreachable) orelse unreachable;