heapless icon indicating copy to clipboard operation
heapless copied to clipboard

Remove implementing Deref<Target = [T]> for HistoryBuf

Open sirhcel opened this issue 3 months ago • 3 comments

There is already as_slice() which gives access to the underlying backing array where the elements are not in the order of writing.

With automatic dereferencing, functions like iter() or windows() are automatically available for HistoryBuf instances and are returning items in an order which does not reflect the write order and will likely surprise users which did not carefully read all the documentation for HistoryBuf like me.

sirhcel avatar Sep 19 '25 09:09 sirhcel

There is more potential for streamlining the interface of HistoryBuf and #611 sets out to tackle these.

sirhcel avatar Sep 19 '25 13:09 sirhcel

Probably worth noting this is a breaking change, as removal of the Deref impl is semver relevant.

jamesmunns avatar Sep 19 '25 15:09 jamesmunns

LGTM. This is a breaking change that should be included in the next breaking change release. Added as sub-issue: https://github.com/rust-embedded/heapless/issues/613

sgued avatar Sep 19 '25 19:09 sgued