rust-lang/rust — pull request #15326 by danburkert (2014-07-02 07:06:39+00:00)
Title: Improved RingBuf implementation.

An alternate implementation of `RingBuf` based on the stdlib `Vec` implementation.

### Pros
1. Performance is about 30-40% better for reads and writes than the
current `RingBuf`. See
[benchmarks](https://github.com/danburkert/rust-ringbuf#benchmarks).
2. Implementations for methods that would be impossible to implement
(efficiently) for the current `RingBuf`: `as_slices`, `into_vec`, and
`from_vec`.
3. More complete method documentation including significantly more
examples.
4. Implementations for missing `RingBuf` functionality:
`Ord`, `PartialOrd`, `move_iter`, `truncate`, `reserve_additional`,
`reserve`, `shrink_to_fit` and `Eq`.

### Cons
1. Based on `Vec`, so a lot of `unsafe`.

### Tests
I have a fair amount of generative [tests](https://github.com/danburkert/rust-ringbuf/blob/master/src/ringbuf.rs#L959) for the implementation, but they have a dependency on [quickcheck](https://github.com/BurntSushi/quickcheck) so I have not included them. The current `RingBuf` tests remain unchanged.

### Breaking Changes
Should be none. A strict superset of functionality is provided.