summaryrefslogtreecommitdiffstats
path: root/src/lisiblestd/string.h
blob: cc7f3f400e9fa0b79d7bb35eb6f6a68a887fd99e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef LSTD_STRING_H
#define LSTD_STRING_H

#include "memory.h"
#include "types.h"
#include <stdbool.h>

struct String {
  char *value;
  usize length;
};
typedef struct String String;
typedef struct StringView StringView;

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
Go back to lisible.xyz