Module uu_tail::chunks

source ·
Expand description

Iterating over a file by chunks, either starting at the end of the file with ReverseChunks or at the end of piped stdin with LinesChunk or BytesChunk.

Use ReverseChunks::new to create a new iterator over chunks of bytes from the file.

Structs

  • A BytesChunk storing a fixed size number of bytes in a buffer.
  • An abstraction layer on top of BytesChunk mainly to simplify filling only the needed amount of chunks. See also Self::fill.
  • Works similar to a BytesChunk but also stores the number of lines encountered in the current buffer. The size of the buffer is limited to a fixed size number of bytes.
  • An abstraction layer on top of LinesChunk mainly to simplify filling only the needed amount of chunks. See also Self::fill. Works similar like BytesChunkBuffer, but works on top of lines delimited by self.delimiter instead of bytes.
  • An iterator over a file in non-overlapping chunks from the end of the file.

Constants

  • When reading files in reverse in bounded_tail, this is the size of each block read at a time.
  • The size of the backing buffer of a LinesChunk or BytesChunk in bytes. The value of BUFFER_SIZE originates from the BUFSIZ constant in stdio.h and the libc crate to make stream IO efficient. In the latter the value is constantly set to 8192 on all platforms, where the value in stdio.h is determined on each platform differently. Since libc chose 8192 as a reasonable default the value here is set to this value, too.