Skip to content

Commit

Permalink
feat: add get_{ref, mut} to arrow_ipc::File{Reader, Writer}
Browse files Browse the repository at this point in the history
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
  • Loading branch information
sticnarf committed Apr 25, 2023
1 parent 6099864 commit 6a21ba4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions arrow-ipc/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,20 @@ impl<R: Read + Seek> FileReader<R> {
))),
}
}

/// Gets a reference to the underlying reader.
///
/// It is inadvisable to directly read from the underlying reader.
pub fn get_ref(&self) -> &R {
self.reader.get_ref()
}

/// Gets a mutable reference to the underlying reader.
///
/// It is inadvisable to directly read from the underlying reader.
pub fn get_mut(&self) -> &mut R {
self.reader.get_mut()
}
}

impl<R: Read + Seek> Iterator for FileReader<R> {
Expand Down
12 changes: 12 additions & 0 deletions arrow-ipc/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,18 @@ impl<W: Write> FileWriter<W> {
Ok(())
}

/// Gets a reference to the underlying writer.
pub fn get_ref(&self) -> &W {
self.writer.get_ref()
}

/// Gets a mutable reference to the underlying writer.
///
/// It is inadvisable to directly write to the underlying writer.
pub fn get_mut(&self) -> &mut W {
self.writer.get_mut()
}

/// Unwraps the BufWriter housed in FileWriter.writer, returning the underlying
/// writer
///
Expand Down

0 comments on commit 6a21ba4

Please sign in to comment.