Module veryfast::small_buffer [] [src]

SmallBuffer is useful as a buffer for elements that see little usage. It has a small capacity inline, so a couple messages will not cause it to allocate memory. If it receives more data than it can store, it will allocate additional memory to handle it. It will not deallocate any memory, for cases when it's likely an element that has seen a lot of usage has a higher chance to continue having high usage.

Structs

Drain

A draining iterator. Returns the contained elements one at a time, removing them from the buffer. If the iterator is dropped, the remaining elements will be dropped and the buffer returned to an empty state.

SmallBuffer

A small inline-allocated buffer with expansion capabilities. Pushing values can be done done asynchronously. Reading values needs exclusive access. Removing values is only possible by draining the whole buffer.