Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Added set/get scratches (#1363)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Jan 16, 2023
1 parent 211be21 commit d97526b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/io/ipc/read/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ impl<R: Read + Seek> FileReader<R> {
self.reader
}

/// Get the inner memory scratches so they can be reused in a new writer.
/// This can be utilized to save memory allocations for performance reasons.
pub fn get_scratches(&mut self) -> (Vec<u8>, Vec<u8>) {
(
std::mem::take(&mut self.data_scratch),
std::mem::take(&mut self.message_scratch),
)
}

/// Set the inner memory scratches so they can be reused in a new writer.
/// This can be utilized to save memory allocations for performance reasons.
pub fn set_scratches(&mut self, scratches: (Vec<u8>, Vec<u8>)) {
(self.data_scratch, self.message_scratch) = scratches;
}

fn read_dictionaries(&mut self) -> Result<()> {
if self.dictionaries.is_none() {
self.dictionaries = Some(read_file_dictionaries(
Expand Down

0 comments on commit d97526b

Please sign in to comment.