diff options
| author | Clement Sibille <clements+git@lisible.xyz> | 2024-05-19 23:33:44 +0900 |
|---|---|---|
| committer | Clement Sibille <clements+git@lisible.xyz> | 2024-05-19 23:33:44 +0900 |
| commit | 399be44fbc3767e7c1ff505119f9e07ee25b1078 (patch) | |
| tree | ff51f3967754aa91577292ead342e8c9348f2c7c /src/lisiblestd/string.h | |
| parent | 5a26e1f481fe85f08093a414e27c1056b85c6715 (diff) | |
Add String_eq and update the String API
Diffstat (limited to '')
| -rw-r--r-- | src/lisiblestd/string.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lisiblestd/string.h b/src/lisiblestd/string.h index 79ee6b8..cc7f3f4 100644 --- a/src/lisiblestd/string.h +++ b/src/lisiblestd/string.h @@ -9,11 +9,20 @@ struct String { char *value; usize length; }; - typedef struct String String; +typedef struct StringView StringView; -bool String_from_str(Allocator *allocator, String *string, const char *str); +String String_new(Allocator *allocator, const char *str); void String_destroy(Allocator *allocator, String *string); +bool String_eq(const String *lhs, const String *rhs); +StringView String_view(const String *str); usize String_length(const String *string); +struct StringView { + const char *value; + usize length; +}; + +StringView StringView_from_str(const char *data); + #endif // LSTD_STRING_H |
