Allocate a buffer to use with [seek_to]. We assume a log line is typically around 150 bytes long, and allocate space to fit `num_lines` in one read. The max size of the buffer is 64KiB.
(num_lines: u32)
| 554 | /// We assume a log line is typically around 150 bytes long, and allocate space |
| 555 | /// to fit `num_lines` in one read. The max size of the buffer is 64KiB. |
| 556 | fn seek_buffer(num_lines: u32) -> Vec<u8> { |
| 557 | let chunk_size = std::cmp::min((num_lines as u64 * 150).next_power_of_two(), 0x10_000); |
| 558 | vec![0; chunk_size as usize] |
| 559 | } |
| 560 | |
| 561 | /// Set `file`'s position such that reading to the end will yield `num_lines`. |
| 562 | /// |
no outgoing calls
no test coverage detected
searching dependent graphs…