netty-incubator-buffer-api/buffer
Chris Vest 7f9ed7dec7 Implement Buf.slice()
Motivation:
Slicing gives you a derived buffer. This is useful for sending along just the part of a buffer that has the relevant data, or to get a new buffer instance for the same data, but with independent read and write offsets.

Modification:
Add slice() methods to the Buf interface, and implement them for MemSegBuf.
Buffer slices increments the reference count of the parent buffer, which prevents the parent from being send()-able.
Slices are themselves also not send()-able.
This is because send() involves ownership transfer, while slicing is like lending out mutable borrows.
The send() capability returns to the parent buffer once all slices are closed.
2020-11-17 15:26:57 +01:00
..
src Implement Buf.slice() 2020-11-17 15:26:57 +01:00