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

Remove from_trusted_len_* from Buffer #1020

Merged
merged 3 commits into from
May 30, 2022
Merged

Remove from_trusted_len_* from Buffer #1020

merged 3 commits into from
May 30, 2022

Conversation

jorgecarleitao
Copy link
Owner

@jorgecarleitao jorgecarleitao commented May 28, 2022

This PR proposes to remove some functions from Buffer since there are more idiomatically achieved with Vec's API.

Specifically, the following are equivalents

  • Buffer::new_zeroed(length) <-> vec![0; length].into()
  • Buffer::from_slice(slice) <-> slice.to_vec().into()
  • Buffer::from_trusted_len_iter(iter) <-> iter.collect::<Vec<_>>().into()
  • Buffer::try_from_trusted_len_iter(iter) <-> iter.collect::<Result<Vec<_>>>()?.into()

This allows the API and documentation of Buffer to focus on its main semantics:

  • O(1) slicing
  • copy on write

@codecov
Copy link

codecov bot commented May 28, 2022

Codecov Report

Merging #1020 (52af809) into main (e976c1e) will increase coverage by 0.00%.
The diff coverage is 85.71%.

@@           Coverage Diff           @@
##             main    #1020   +/-   ##
=======================================
  Coverage   71.63%   71.64%           
=======================================
  Files         359      359           
  Lines       19904    19893   -11     
=======================================
- Hits        14259    14252    -7     
+ Misses       5645     5641    -4     
Impacted Files Coverage Δ
src/array/map/mod.rs 64.19% <0.00%> (ø)
src/array/mod.rs 67.02% <ø> (ø)
src/buffer/immutable.rs 97.77% <ø> (+4.92%) ⬆️
src/array/binary/mod.rs 84.46% <100.00%> (ø)
src/array/fixed_size_binary/mod.rs 88.34% <100.00%> (ø)
src/array/list/mod.rs 69.91% <100.00%> (ø)
src/array/primitive/mod.rs 78.63% <100.00%> (ø)
src/array/union/mod.rs 79.64% <100.00%> (ø)
src/array/utf8/mod.rs 73.40% <100.00%> (ø)
src/bitmap/utils/slice_iterator.rs 87.93% <0.00%> (+1.72%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e976c1e...52af809. Read the comment docs.

@jorgecarleitao jorgecarleitao added the help wanted Extra attention is needed label May 28, 2022
@jorgecarleitao jorgecarleitao changed the title [proposal] remove from_trusted_len_* from Buffer Remove from_trusted_len_* from Buffer May 30, 2022
@jorgecarleitao jorgecarleitao merged commit 266fbbe into main May 30, 2022
@jorgecarleitao jorgecarleitao deleted the clean_api branch May 30, 2022 18:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backwards-incompatible help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant