Okay, unconst it I guess
This commit is contained in:
parent
7477e55349
commit
1e8d0ca852
1 changed files with 2 additions and 2 deletions
|
|
@ -59,14 +59,14 @@ pub fn parseArgs(comptime T: type, allocator: Allocator) !T {
|
||||||
const args = try std.process.argsAlloc(allocator);
|
const args = try std.process.argsAlloc(allocator);
|
||||||
defer std.process.argsFree(allocator, args);
|
defer std.process.argsFree(allocator, args);
|
||||||
|
|
||||||
return parseArgsFromSlice(T, allocator, @constCast(args[1..]));
|
return parseArgsFromSlice(T, allocator, args[1..]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All items of `args` must be valid, otherwise you will get a General Protection Fault.
|
/// All items of `args` must be valid, otherwise you will get a General Protection Fault.
|
||||||
/// Do not pass the process name as an argument.
|
/// Do not pass the process name as an argument.
|
||||||
///
|
///
|
||||||
/// Parsing order of arguments is based on the order they are declared in `T`.
|
/// Parsing order of arguments is based on the order they are declared in `T`.
|
||||||
pub fn parseArgsFromSlice(comptime T: type, allocator: Allocator, args: [][:0]const u8) !T {
|
pub fn parseArgsFromSlice(comptime T: type, allocator: Allocator, args: [][:0]u8) !T {
|
||||||
var flags = try std.ArrayList(Arg).initCapacity(allocator, 4);
|
var flags = try std.ArrayList(Arg).initCapacity(allocator, 4);
|
||||||
defer flags.deinit(allocator);
|
defer flags.deinit(allocator);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue