I would like to implement a “strings” like command line tool in Rust. It should work very fast on big binary files and filter out valid e.g. Unicode strings. The stream can be 32bit, 64bit, big endian or little endian,
I am a beginner in Rust and hope some expert can help:
- I need a window of 1024 Bytes over the stream/file that I can advance Byte by Byte until the end of the stream.
- Inside the window I search for some valid string encodings meeting some additional criteria and print the string.
- When done I advance the window by 1 Byte and go to 2.
Speed is critical this is why a minimum copying is required. How do I implement 1.?
Can I avoid an additional ring-buffer?
If not how to implement it?
Is this possible without unsafe code? Any ideas?
Code extracts are welcome.