heapless
heapless copied to clipboard
HistoryBuffer Add pop_oldest
Motivation
There currently is no interface for removing elements from the HistoryBuffer.
Added
HistoryBuffer.pop_oldest()HistoryBuffer.filled()getter to replacefilledmember variable- Unit test for
HistoryBuffer.pop_oldest()
Changed
HistoryBuffer.len()to be a getter rather than computed on call.HistoryBuffer.write()HistoryBuffer.recent()HistoryBuffer.oldest_ordered()OldestOrdered.next()
Warning
HistoryBuffer.as_slice() no longer has the same meaning. The slice returned may contain unused values.
what's the use case for this? It seems to me there's a lot of overlap with Deque here. IMO if you need push/pop you should use Deque, and HistoryBuffer should be used only when you want to do "statistics" on the last N values, not as a queue you pop things from.