https://github.com/rggh/log_buffer
Log Buffer in Rust
https://github.com/rggh/log_buffer
buffer dequeue rust
Last synced: 4 months ago
JSON representation
Log Buffer in Rust
- Host: GitHub
- URL: https://github.com/rggh/log_buffer
- Owner: RGGH
- Created: 2024-11-19T20:55:07.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-19T21:12:02.000Z (about 1 year ago)
- Last Synced: 2025-02-02T03:31:48.261Z (11 months ago)
- Topics: buffer, dequeue, rust
- Language: Rust
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Log Buffer (in Rust 🦀)
- uses double ended queue
- use to_owned() to avoid lifetime issues
---
Data Structure:
VecDeque is used because it efficiently supports adding/removing elements from both ends.
Capacity Handling:
When the buffer reaches its capacity, the oldest log is removed using pop_front.
Adding Logs:
New logs are added to the end with push_back.
Retrieving Logs:
get_logs returns a vector containing all the logs in order.