Skip to content

rtrb 0.2.0

Compare
Choose a tag to compare
@mgeier mgeier released this 20 Sep 19:29
· 68 commits to main since this release

Breaking Changes

  • split() has been removed, new() returns a (Producer, Consumer) pair
    • a RingBuffer cannot be owned anymore (but Producer and Consumer still can)
    • previous uses of split() can simply be removed
  • new chunks module
    • simplifies the main documentation page
    • no code changes should be needed, except that ChunkError has to be imported as chunks::ChunkError
  • iterator API has been changed to allow moving items in and out
    • read chunks implement IntoIterator and can be directly used in for loops or can be explicitly turned into an iterator with into_iter()
    • uninitialized write chunks provide a fill_from_iter() method that moves items from an iterator into the ring buffer
    • Default-initialized write chunks don't provide an iterator API (just use uninitialized chunks instead)
    • the previous iterator API with items of type &T, &mut T and &mut MaybeUninit<T> is not available anymore, but it can be emulated by iterating over the slices returned by as_slices() and as_mut_slices() (use chain() to iterate over both slices)
  • with_chunks() constructor has been removed
    • there is no replacement, use new() instead
  • reset() has been removed
    • there is no replacement
  • CopyToUninit::copy_to_uninit() now returns &mut [T]
    • this is strictly speaking a breaking change, but it's unlikely that anyone relied on it returning nothing

Non-Breaking Changes

  • Copy trait bound has been removed from write_chunk() (Default is still required)
  • some auto-derived Debug, Eq and PartialEq implementations have been added