book icon indicating copy to clipboard operation
book copied to clipboard

Add arrays to the list of types that implement `Copy`

Open lucatrv opened this issue 2 years ago • 3 comments
trafficstars

lucatrv avatar Dec 11 '22 16:12 lucatrv

This is interesting, I didn't realize that arrays were also able to be copy. Tested it and seems it's true.

I guess it's good to include it in the book but I always second guess giving too much information even if it's true and overwhelming beginners.

c-git avatar Dec 11 '22 20:12 c-git

@c-git here is the reference. If you prefer I can divide tuples and arrays in two sentences, maybe it becomes clearer. Moreover in my opinion it would be helpful to add a background note explaining that differently from arrays, vectors (which are allocated in the heap instead of in the stack) do not implement the Copy trait. If you agree I can add these two points to my PR.

lucatrv avatar Dec 11 '22 21:12 lucatrv

I think it's fine as is. I wouldn't add more to it at this point. I guess reading the docs would have shortened my testing but it was still fun.

c-git avatar Dec 11 '22 22:12 c-git