pub struct FileChunker { /* private fields */ }
Implementations§
Source§impl FileChunker
impl FileChunker
Sourcepub fn chunks(
&self,
count: usize,
delimiter: Option<char>,
) -> Result<Vec<&[u8]>>
pub fn chunks( &self, count: usize, delimiter: Option<char>, ) -> Result<Vec<&[u8]>>
Divide the file into chunks approximately equal size. Returns a vector of memory-mapped slices that each correspond to a chunk.
If a delimeter is provided, then each chunk will end with an instance of the delimeter, assuming the delimiter exists in the file. This is useful when working with text files that have newline characters, for example. If no delimeter is provided, then each chunk will be the same size, except for the last chunk which may be smaller.
It is assumed that the underlying File
will not change while this function is running.
Auto Trait Implementations§
impl Freeze for FileChunker
impl RefUnwindSafe for FileChunker
impl Send for FileChunker
impl Sync for FileChunker
impl Unpin for FileChunker
impl UnwindSafe for FileChunker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more