Struct file_chunker::FileChunker
source · [−]pub struct FileChunker { /* private fields */ }
Implementations
sourceimpl 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 RefUnwindSafe for FileChunker
impl Send for FileChunker
impl Sync for FileChunker
impl Unpin for FileChunker
impl UnwindSafe for FileChunker
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more