Skip to content

From<[T; M]> for CircularBuffer<N> where N < M should panic #9

Description

@brett-lempereur

I ran into this while setting up a unit test that I expected to panic. It's fairly simple to reproduce:

let buffer: CircularBuffer<2; u8> = [0x01, 0x02, 0x03].into();

The issue seems to be here https://github.com/andreacorbellini/rust-circular-buffer/blob/master/src/lib.rs#L1686. I guess this is a design choice, but I don't think I'd ever want to silently discard array elements while constructing a circular buffer.

It's a small (breaking) change, and I'm happy to open the MR for it. Thanks for the awesome library!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions