Skip to content

Commit 985ec7e

Browse files
cetra3alamb
andauthored
Add get_ref/get_mut to JSON Writer (#7854)
# Which issue does this PR close? None # Rationale for this change I need access to the writer so that I can flush an external buffer when bytes are written. # What changes are included in this PR? A couple of methods to the JSON writer. These methods already exist on other writers # Are these changes tested? N/A # Are there any user-facing changes? Yes, a couple extra methods on the JSON writer. --------- Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
1 parent a3584e5 commit 985ec7e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

arrow-json/src/writer/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,19 @@ where
413413
Ok(())
414414
}
415415

416+
/// Gets a reference to the underlying writer.
417+
pub fn get_ref(&self) -> &W {
418+
&self.writer
419+
}
420+
421+
/// Gets a mutable reference to the underlying writer.
422+
///
423+
/// Writing to the underlying writer must be done with care
424+
/// to avoid corrupting the output JSON.
425+
pub fn get_mut(&mut self) -> &mut W {
426+
&mut self.writer
427+
}
428+
416429
/// Unwraps this `Writer<W>`, returning the underlying writer
417430
pub fn into_inner(self) -> W {
418431
self.writer

0 commit comments

Comments
 (0)