You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You derive Clone on TinyVec/ArrayVec. This means you get the default impl of clone_from, which doesn't allow items stored inside these to reuse their memory. (Ideally, #[derive(Clone)] would do this, but they don't, as it would increase compile time for all rust programs for a rarely-used method. Thankfully, at least all the stdlib container provide impls of this...)
I'm using this for a TinyVec<[FloatImagePlane; 4]> (a float image plane being a Vec<f32> and some metadata). These cane be fairly large, so I'd have an option to have the memory reused.
* improve clone impl as per #143
* per #144 (comment)
* rustfmt.
* formatting
* whoops haha that's a little tricky to get the types to line up
we don't have deref for the A so we have to keep using as_slice_mut and such
You derive Clone on TinyVec/ArrayVec. This means you get the default impl of
clone_from
, which doesn't allow items stored inside these to reuse their memory. (Ideally,#[derive(Clone)]
would do this, but they don't, as it would increase compile time for all rust programs for a rarely-used method. Thankfully, at least all the stdlib container provide impls of this...)I'm using this for a
TinyVec<[FloatImagePlane; 4]>
(a float image plane being aVec<f32>
and some metadata). These cane be fairly large, so I'd have an option to have the memory reused.I think this implementation that should work. I didn't write tests, and don't have time to PR it. https://gist.github.com/thomcc/56f9804d23459da4650112a573acf9dd.
The text was updated successfully, but these errors were encountered: