Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Added set_len method to Buffer #1374

Merged

Conversation

haixuanTao
Copy link
Contributor

Adding set_len enables to change the length value of the buffer.

This is required if get_mut changes the length of the buffer.

I think it will be great to add generic vector method such as extend_from_slice, copy_from_slice, with the according length change. I can add it to this pull request if interested.

@codecov
Copy link

codecov bot commented Feb 12, 2023

Codecov Report

Base: 83.61% // Head: 83.67% // Increases project coverage by +0.06% 🎉

Coverage data is based on head (4a654f6) compared to base (615300b).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1374      +/-   ##
==========================================
+ Coverage   83.61%   83.67%   +0.06%     
==========================================
  Files         373      373              
  Lines       40326    40329       +3     
==========================================
+ Hits        33720    33747      +27     
+ Misses       6606     6582      -24     
Impacted Files Coverage Δ
src/buffer/immutable.rs 86.66% <0.00%> (-2.55%) ⬇️
src/bitmap/utils/slice_iterator.rs 97.56% <0.00%> (-1.22%) ⬇️
src/array/utf8/mod.rs 83.98% <0.00%> (-1.18%) ⬇️
src/io/ipc/read/stream_async.rs 76.02% <0.00%> (-0.69%) ⬇️
src/offset.rs 86.11% <0.00%> (+0.34%) ⬆️
src/io/ipc/read/file_async.rs 72.76% <0.00%> (+11.56%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Adding `set_len` enables to change the length value of the buffer.

This is required if `get_mut` changes the length of the buffer.
@jorgecarleitao jorgecarleitao changed the title Adding set_len method to Buffer Added set_len method to Buffer Mar 7, 2023
@jorgecarleitao jorgecarleitao merged commit f258a3e into jorgecarleitao:main Mar 7, 2023
@jorgecarleitao
Copy link
Owner

Thank you for the PR! 🙇 Indeed this is needed in some cases.

@jorgecarleitao jorgecarleitao added the enhancement An improvement to an existing feature label Mar 7, 2023
@jorgecarleitao
Copy link
Owner

Note that Buffer is primarily an immutable container (think Arc<Vec<>>), this is why we do not expose mutable methods to it (other than returning the mutable vector ^^)

@haixuanTao haixuanTao deleted the add-buffer-set-length branch March 8, 2023 07:42
ritchie46 pushed a commit to ritchie46/arrow2 that referenced this pull request Mar 29, 2023
Adding `set_len` enables to change the length value of the buffer.

This is required if `get_mut` changes the length of the buffer.
ritchie46 pushed a commit to ritchie46/arrow2 that referenced this pull request Apr 5, 2023
Adding `set_len` enables to change the length value of the buffer.

This is required if `get_mut` changes the length of the buffer.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement An improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants