pub unsafe extern "C" fn aws_byte_buf_write_to_capacity(
    buf: *mut aws_byte_buf,
    advancing_cursor: *mut aws_byte_cursor
) -> aws_byte_cursor
Expand description

Without increasing buf’s capacity, write as much as possible from advancing_cursor into buf.

buf’s len is updated accordingly. advancing_cursor is advanced so it contains the remaining unwritten parts. Returns the section of advancing_cursor which was written.

This function cannot fail. If buf is full (len == capacity) or advancing_len has 0 length, then buf and advancing_cursor are not altered and a cursor with 0 length is returned.

Example: Given a buf with 2 bytes of space available and advancing_cursor with contents “abc”. “ab” will be written to buf and buf->len will increase 2 and become equal to buf->capacity. advancing_cursor will advance so its contents become the unwritten “c”. The returned cursor’s contents will be the “ab” from the original advancing_cursor.