-
Notifications
You must be signed in to change notification settings - Fork 57
feat(TinyVec): add into_vec() & into_boxed_slice()
#206
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
Conversation
Lokathor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one little typo in the doc comments
src/tinyvec.rs
Outdated
| } | ||
| } | ||
|
|
||
| /// Converts a `TinyVec<[T; N]>` into a `Box<T>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should say Box<[T]>
|
oops, might want to pick smaller array sizes for the doctest example |
Now, |
|
When I changed the doc comment: I re-ran |
rustfmt.toml: replace deprecated
fn_args_layoutwithfn_args_layoutsee also: Rename
fn_args_layoutconfig option rust-lang/rustfmt#4149benches/smallvec.rs: After running
cargo +nightly fmt, the format was automatically changed.src/tinyvec.rs:
impl<A: Array> Into<Vec<A::Item>> for TinyVec<A>into_vec()&into_boxed_slice()into_vec()
The specific implementation is in the
into()method ofimpl Into<Vec<A::Item>>.into_boxed_slice()
Converts a
TinyVec<[T; N]>into aBox<[T]>.TinyVec::Heap(Vec<T>), it takes theVec<T>and converts it intoa
Box<[T]>without heap reallocation.TinyVec::Inline(inner_data), it first converts theinner_datatoVec<T>, then into aBox<[T]>. Requiring only a single heapallocation.
Example
Closes #205