You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/06/30 09:59:54 UTC

[GitHub] [arrow-rs] tustvold commented on issue #1969: close function instead of mutable reference

tustvold commented on issue #1969:
URL: https://github.com/apache/arrow-rs/issues/1969#issuecomment-1171016207

   This was an intentional change, to truncate the lifetime of the writer on calling close. See this thread for more context https://github.com/apache/arrow-rs/pull/1719#discussion_r878742614
   
   The change is more obviously beneficial on the ColumnWriter, etc... but you can also see it on ArrowWriter. Consider
   
   ```
   let file = File::create(&path).unwrap();
   let writer = ArrowWriter::try_new(&mut file, ...);
   
   ...
   
   writer.close();
   
   file.rewind().unwrap();
   ```
   
   Without this change you need to manually drop the `writer` in order to reuse the file. We also benefit from the borrow checker making sure we can't call close multiple times.
   
   If you are integrating with some system that requires `&mut self` for some reason, Option::take should allow you to get the previous semantics.
   
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org