Skip to content

Add get_ref/get_mut to JSON Writer #7854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cetra3
Copy link

@cetra3 cetra3 commented Jul 3, 2025

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.

@github-actions github-actions bot added the arrow Changes to the arrow crate label Jul 3, 2025
@adriangb
Copy link
Contributor

adriangb commented Jul 3, 2025

@alamb this is a minor simple change, as Peter said it's already on the IPC writer:

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

Could we get this merged?

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @cetra3 and @adriangb
I think the API makes a lot of sense, but I think we should clarify the comment on get_mut

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants