Rich-T-kid commented on code in PR #10262:
URL: https://github.com/apache/arrow-rs/pull/10262#discussion_r3540901541
##########
arrow-ipc/src/compression.rs:
##########
@@ -46,10 +46,20 @@ impl IpcWriteContext {
/// Set whether the scratch buffer capacity should be reserved after each
encode for reuse
/// on the next call. Set to `false` for the final batch in a sequence to
avoid a
- /// pointless allocation.
+ /// pointless allocation. by default, this is set to `false`.
pub fn set_reserve_scratch(&mut self, reserve: bool) {
self.reserve_scratch = reserve;
}
+ /// Reserve the scratch buffer capacity for reuse on the next call. This
is a no-op if
+ /// `reserve_scratch` is set to `false`.
+ pub(crate) fn reserve_scratch_with_capacity(&mut self, additional: usize) {
+ if self.reserve_scratch {
+ self.scratch.reserve(additional);
+ }
+ }
+ pub(crate) fn scratch(&mut self) -> Vec<u8> {
Review Comment:
we can actually make the field private now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]