Skip to content

new constructors: from_buf_and_len(_unchecked) #117

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

Merged
merged 1 commit into from
Aug 20, 2018

Conversation

llogiq
Copy link
Contributor

@llogiq llogiq commented Aug 20, 2018

Those functions allow to create an inline SmallVec supplying both buf and len arguments, so only a part of the buffer is used. The unchecked variant doesn't check if the length is less or equal than the buffer length.

This allows users to set up a partially used in-band buffer in one step (instead of using from_buf and calling truncate or set_len later).


This change is Reviewable

Those functions allow to create an inline SmallVec supplying both
buf and len arguments, so only a part of the buffer is used. The
unchecked variant doesn't check if the length is less or equal
than the buffer length.
@mbrubeck
Copy link
Collaborator

@bors-servo r+

Thanks!

@bors-servo
Copy link
Contributor

📌 Commit 7a41a66 has been approved by mbrubeck

bors-servo pushed a commit that referenced this pull request Aug 20, 2018
new constructors: from_buf_and_len(_unchecked)

Those functions allow to create an inline SmallVec supplying both buf and len arguments, so only a part of the buffer is used. The unchecked variant doesn't check if the length is less or equal than the buffer length.

This allows users to set up a partially used in-band buffer in one step (instead of using `from_buf` and calling `truncate` or `set_len` later).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/117)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

⌛ Testing commit 7a41a66 with merge 191bc11...

@bors-servo
Copy link
Contributor

☀️ Test successful - status-travis
Approved by: mbrubeck
Pushing 191bc11 to master...

@bors-servo bors-servo merged commit 7a41a66 into servo:master Aug 20, 2018
@llogiq llogiq deleted the from_buf_and_len branch August 20, 2018 20:08
@llogiq
Copy link
Contributor Author

llogiq commented Aug 20, 2018

Thanks @mbrubeck 👍

@llogiq
Copy link
Contributor Author

llogiq commented Aug 21, 2018

By the way, @mbrubeck can we get a new release with this?

mbrubeck added a commit to mbrubeck/rust-smallvec that referenced this pull request Aug 22, 2018
Change log:

* servo#115 - add `into_inner` method
* servo#117 - add `from_buf_and_len` and `from_buf_and_len_unchecked`
* servo#118 - optimize `from_slice`
* Some code cleanup and testing improvements (servo#112, servo#113, servo#114, servo#120)
@mbrubeck mbrubeck mentioned this pull request Aug 22, 2018
bors-servo pushed a commit that referenced this pull request Aug 22, 2018
Version 0.6.5

Change log:

* #115 - add `into_inner` method
* #117 - add `from_buf_and_len` and `from_buf_and_len_unchecked`
* #118 - optimize `from_slice`
* Some code cleanup and testing improvements (#112, #113, #114, #120)

cc @llogiq

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/121)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants