inetstack
inetstack copied to clipboard
[inetstack] Allow `TcpSegment`'s `data` Field to be Optional
This PR changes the TcpSegment
struct so that the data
field is now Option<Buffer>
instead of Buffer
. This struct is used in issuing transmission requests to the runtime. Before this change, sending a header-only TCP segment required one to create an empty Buffer
just to be able to have something to fill this field. When Buffer
was a pure stack object, this was still somewhat acceptable, now that we're planning on having all Buffer
s live in the heap, this change will save us from needless allocations.
This PR fixes Issue #202.