diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/json.h | 2 | ||||
| -rw-r--r-- | include/str.h | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/include/json.h b/include/json.h index 749a3e0..9bd668e 100644 --- a/include/json.h +++ b/include/json.h @@ -24,7 +24,7 @@ typedef struct { i32 integer; f32 floating; Vec array; // Vec<JSON> - Str string; + StrView string; JSONObject object; } as; } JSON; diff --git a/include/str.h b/include/str.h index 300d5ea..3ccd072 100644 --- a/include/str.h +++ b/include/str.h @@ -12,7 +12,14 @@ typedef struct { byte *data; size len; } Str; +typedef struct { + byte *data; + size len; +} StrView; i32 Str_equals(Str a, Str b); u64 Str_hash64(Str s); Str Str_copy(Arena *a, byte *data, size len); i32 Str_fprint(FILE *w, Str s); + +StrView Str_view(byte *data, size len); +i32 StrView_fprint(FILE *w, StrView s); |
