Ruby 4.1.0dev (2026-10-26 revision 6b15825df0fce73e868b99f98c689755e46cfc8c)
stringy.h
Go to the documentation of this file.
1
6#ifndef PRISM_STRINGY_H
7#define PRISM_STRINGY_H
8
11
12#include <stddef.h>
13#include <stdint.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
23typedef struct {
25 const uint8_t *source;
26
28 size_t length;
30
39PRISM_EXPORTED_FUNCTION void pm_string_init(pm_string_t *string, const uint8_t *source, size_t length) PRISM_NONNULL(1);
40
48
56
57#ifdef __cplusplus
58}
59#endif
60
61#endif
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
Definition exported.h:20
#define PRISM_NONNULL(...)
Mark the parameters of a function as non-null.
Definition nonnull.h:13
PRISM_EXPORTED_FUNCTION void pm_string_init(pm_string_t *string, const uint8_t *source, size_t length) PRISM_NONNULL(1)
Initialize a string that views the given bytes.
Definition stringy.c:23
PRISM_EXPORTED_FUNCTION size_t pm_string_length(const pm_string_t *string) PRISM_NONNULL(1)
Returns the length associated with the string.
Definition stringy.c:51
PRISM_EXPORTED_FUNCTION const uint8_t * pm_string_source(const pm_string_t *string) PRISM_NONNULL(1)
Returns the start pointer associated with the string.
Definition stringy.c:59
A view of a sequence of bytes.
Definition stringy.h:23
const uint8_t * source
A pointer to the start of the string.
Definition stringy.h:25
size_t length
The length of the string in bytes of memory.
Definition stringy.h:28