16#define WIRED_SPAN_ARG(s) (int)(s).n, (const char*)(s).p
Cursor byte-copy helpers shared by the frame codecs.
static usz wired_cstr_len(const char *s)
Freestanding NUL-terminated string length.
Definition bytes.h:112
Value-type views that fold the SDK's recurring argument shapes into single parameters,...
static wired_span wired_span_of(const u8 *p, usz n)
Make a read-only span over p[0..n).
Definition span.h:70
Growing output buffer view for variable-length results.
Definition span.h:54
Read-only view of a byte range.
Definition span.h:30
void wired_dump_text(i64 fd, wired_span s)
Write the bytes of s to fd as they are (a text view needs no NUL).
ssz wired_span_find(wired_span s, u8 c)
Index of the first byte c in s.
int wired_span_eq(wired_span a, wired_span b)
Whether a and b hold the same bytes (same length, same content).
wired_span wired_span_strip_lead(wired_span s, u8 c)
s without one leading byte c, or s itself when it does not start with c (e.g.
usz wired_hex_encode(char *out, usz cap, wired_span s)
Lowercase hex of s into out, NUL-terminated; stops at the last whole byte that fits in cap - 1 charac...
static wired_span wired_span_cstr(const char *s)
View of a NUL-terminated string's bytes (the NUL excluded).
Definition text.h:23
void wired_dump_hex(i64 fd, wired_span s)
Write s to fd as lowercase hex, no separators and no newline.
usz wired_cstr_append(char *dst, usz cap, usz at, wired_span s)
Append s to the C string in dst at offset at, keeping dst NUL-terminated and cutting at cap - 1 bytes...
int wired_cstr_eq(const char *a, const char *b)
Whether two NUL-terminated strings are equal.
usz wired_obuf_put(wired_obuf *b, wired_span s)
Append the bytes of s to b at b->len, cut at b->cap (no NUL is written).
usz wired_span_to_cstr(char *out, usz cap, wired_span s)
Copy s into out as a NUL-terminated string, truncated to cap - 1 bytes.
int wired_span_eq_cstr(wired_span s, const char *lit)
Whether s holds exactly the bytes of the NUL-terminated lit.
long i64
signed 64-bit integer
Definition types.h:14
u64 usz
unsigned size (size_t equivalent)
Definition types.h:20
i64 ssz
signed size (ssize_t equivalent)
Definition types.h:19
unsigned char u8
unsigned 8-bit integer / byte
Definition types.h:18