Closed
Description
I've realized I don't have intuition about how Rust's constructs like Slices and Vecs are laid out in memory, and thus how much of them are inline in structs, how much can be on stack, how much gets copied around.
I've seen mentions how many fields slices and vectors have, but that's not quite enough to visualize how, e.g. Option<Box<Vec<T>>>
looks like.
Slices are passed to functions as &[T]
, but does &[&[T]]
make sense? Should it be [[T]]
?
I'd love to see some diagrams that show how many pointer indirections are involved in usage of complex types.
Metadata
Metadata
Assignees
Labels
No labels