So I am reading now the Vec implementation part of the nomicon book and I can't understand how does the Drop trait is called for T's, e.g. how does std::ptr::read leaves the memory logically uninitialized, I am not able to find any documentation to backup this statement, and what would "logically unintialized" mean?
From the book
For this we need ptr::read, which just copies out the bits from the target address and interprets it as a value of type T. This will leave the memory at this address logically uninitialized, even though there is in fact a perfectly good instance of T there.
After I read the ptr from that specific memory address, am I able to read it again as its only creating copy bits aligned for T and if so, where does the "unitialization" happens or under which circumstances?
All the documentation that there is for std::ptr::read is
Reads the value from src without moving it. This leaves the memory in src unchanged.
So I am reading now the Vec implementation part of the nomicon book and I can't understand how does the Drop trait is called for T's, e.g. how does
std::ptr::read
leaves the memory logically uninitialized, I am not able to find any documentation to backup this statement, and what would "logically unintialized" mean?From the book
After I read the ptr from that specific memory address, am I able to read it again as its only creating copy bits aligned for T and if so, where does the "unitialization" happens or under which circumstances?
All the documentation that there is for
std::ptr::read
is