logbuffer_ is a Rust crate implementing a zero-allocation ring buffer
for storing text logs. It does not depend on std
, but can be used
with std::vec::Vec
if desired.
See the documentation for details.
To use the logbuffer_ library in your project, add the following to Cargo.toml
:
toml
[dependencies]
log_buffer = "1.0"
```rust use core::fmt::Write;
let mut dmesg = log_buffer::LogBuffer::new([0; 16]); write!(dmesg, "\nfirst\n").unwrap(); write!(dmesg, "second\n").unwrap(); write!(dmesg, "third\n").unwrap();
asserteq!(dmesg.extract(),
"st\nsecond\nthird\n");
asserteq!(dmesg.extract_lines().collect::
See the documentation for more examples.
logbuffer_ is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.