the Rust documentation says, that this trait should be implemented for “Types with a constant size known at compile time.”.
My question is now:
As far as I understood it, that “Size” refers to the struct itself and not to the whole object tree, so that the compiler knows how much space he has to reserve in the stackframe.
But it seems I was wrong, since “the root struct” std::string::String has a fixed size (the struct contains a vec which contains a pointer to the heap, where the dynamically growing happens) and you can declare a local variable of it (in contrast to a dyn trait eg: std::clone::Clone) which needs room on the stack, but it is not implementing the std::marker::Sized trait.
Why does String not implement the Sized trait and where are the contradictions/issues in my mental model ?
thanks in advance
Gerhard