Description
I was reading about Box from here https://doc.rust-lang.org/stable/rust-by-example/std/box.html
There is the below code in code snippet :
// box size == pointer size
println!("Boxed point occupies {} bytes on the heap",
mem::size_of_val(&boxed_point));
println!("Boxed rectangle occupies {} bytes on the heap",
mem::size_of_val(&boxed_rectangle));
println!("Boxed box occupies {} bytes on the heap",
mem::size_of_val(&box_in_a_box));
I increased the variables in Point struct and mades its size 40 bytes on stack but still the Box size is 8 bytes , so in this code . I think the statements should be Boxed point occupies {} bytes on the stack instead of the heap. Basically I am saying that Box is holding an address value of the actual structure and the size of box is 8 bytes which is fixed.
If this is right , can I raise a PR with the Fix ?
Metadata
Metadata
Assignees
Labels
No labels