Expand description
Slices of files
FileSlice is to File what Bytes is to
Vec<u8>. Advantages over File:
- You can slice it, reducing the scope to a range within the original file
- Cloning is cheap (atomic addition; no syscall)
- Seeking is very cheap (normal addition; no syscall)
- Clones can’t affect each other at all (the fd’s real cursor is never used).
Optional features
Optional integrations for crates which naturally benefit from file slicing:
tar: Adds aslice_tarballhelper method for splitting up atar::Archiveinto a bunch ofFileSlices.parquet: Adds aChunkReaderimpl forFileSlice. A parquet file contains many pages, and the decoder needs to interleave reads from these pages. TheChunkReaderimpl forFileaccomplishes this by making many clones of the fd. UsingFileSliceinstead lets you open ~7 as many parquet files before you hit your fd limit.
Structs
A slice of a file