Appends data as one chunk. An empty data writes nothing: a chunk of size 0 would end the
body (use write_last_chunk).
Appends data to out as one chunk of a chunked body: the size in hex, CRLF, the bytes, CRLF. Nothing is written for empty
data. out is a growing array the caller owns (it uses the context allocator); end the body with write_last_chunk.
out: [..] u8;
defer array_free(out);
write_chunk(*out, "hello");
write_chunk(*out, ""); // empty: nothing is written
assert(write_last_chunk(*out));
assert(string.{ out.count, out.data } == "5\r\nhello\r\n0\r\n\r\n");write_chunk :: (out: *[..] u8, data: [] u8)
Appends data as one chunk. An empty data writes nothing: a chunk of size 0 would end the
body (use write_last_chunk).
Appends data to out as one chunk of a chunked body: the size in hex, CRLF, the bytes, CRLF. Nothing is written for empty
data. out is a growing array the caller owns (it uses the context allocator); end the body with write_last_chunk.
Parameters
- out: *[..] u8
- data: [] u8
out: [..] u8;
defer array_free(out);
write_chunk(*out, "hello");
write_chunk(*out, ""); // empty: nothing is written
assert(write_last_chunk(*out));
assert(string.{ out.count, out.data } == "5\r\nhello\r\n0\r\n\r\n");write_chunk :: (out: *[..] u8, data: string)
The write_chunk for a string.
Parameters
- out: *[..] u8
- data: string