authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-07-31 18:18:59 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-07-31 18:18:59 -07:00
log41930cedb77d193e5cbfd6a2e4bed3d25262dd57
treef35146b81339389d3dc6e6c194ab23b0e70f3013
parentbd01c347af73ff79666d357545b3e821c83fdaf8

fix signature bug in matchesAll and matchesAny

previously it would error if T was anything other than u8

1 files changed, 2 insertions(+), 2 deletions(-)

src/lib.zig+2-2
...@@ -482,7 +482,7 @@ pub fn sliceTo(comptime T: type, haystack: []const T, needle: T) []const T {...@@ -482,7 +482,7 @@ pub fn sliceTo(comptime T: type, haystack: []const T, needle: T) []const T {
482 return haystack;482 return haystack;
483}483}
484484
485pub fn matchesAll(comptime T: type, haystack: []const u8, comptime needle: fn (T) bool) bool {485pub fn matchesAll(comptime T: type, haystack: []const T, comptime needle: fn (T) bool) bool {
486 for (haystack) |c| {486 for (haystack) |c| {
487 if (!needle(c)) {487 if (!needle(c)) {
488 return false;488 return false;
...@@ -491,7 +491,7 @@ pub fn matchesAll(comptime T: type, haystack: []const u8, comptime needle: fn (T...@@ -491,7 +491,7 @@ pub fn matchesAll(comptime T: type, haystack: []const u8, comptime needle: fn (T
491 return true;491 return true;
492}492}
493493
494pub fn matchesAny(comptime T: type, haystack: []const u8, comptime needle: fn (T) bool) bool {494pub fn matchesAny(comptime T: type, haystack: []const T, comptime needle: fn (T) bool) bool {
495 for (haystack) |c| {495 for (haystack) |c| {
496 if (needle(c)) {496 if (needle(c)) {
497 return true;497 return true;