wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
span.h
Go to the documentation of this file.
1#ifndef SPAN_H
2#define SPAN_H
3
5
22
30typedef struct {
31 const u8* p;
34
42typedef struct {
43 u8* p;
46
54typedef struct {
55 u8* p;
59
70static inline wired_span wired_span_of(const u8* p, usz n) {
71 wired_span s = {p, n};
72 return s;
73}
74
85static inline wired_mspan wired_mspan_of(u8* p, usz n) {
86 wired_mspan s = {p, n};
87 return s;
88}
89
101static inline wired_obuf obuf_of(u8* p, usz cap) {
102 wired_obuf b = {p, cap, 0};
103 return b;
104}
105
106#endif
static wired_span wired_span_of(const u8 *p, usz n)
Make a read-only span over p[0..n).
Definition span.h:70
static wired_obuf obuf_of(u8 *p, usz cap)
Make an output buffer over p[0..cap) with len starting at 0.
Definition span.h:101
static wired_mspan wired_mspan_of(u8 *p, usz n)
Make a mutable span over p[0..n).
Definition span.h:85
Mutable view of a byte range.
Definition span.h:42
usz n
number of writable bytes at p
Definition span.h:44
u8 * p
first byte of the writable range (not owned)
Definition span.h:43
Growing output buffer view for variable-length results.
Definition span.h:54
usz cap
capacity of p in bytes
Definition span.h:56
usz len
bytes written so far; the callee advances this
Definition span.h:57
u8 * p
caller-provided storage (not owned)
Definition span.h:55
Read-only view of a byte range.
Definition span.h:30
usz n
number of readable bytes at p
Definition span.h:32
const u8 * p
first byte of the viewed range (not owned)
Definition span.h:31
Linux direct syscalls.
u64 usz
unsigned size (size_t equivalent)
Definition types.h:20
unsigned char u8
unsigned 8-bit integer / byte
Definition types.h:18