Stack Memory

    1. fn main() {
    2. s1.push(' ');
    3. s1.push_str("world");
    4. // DON'T DO THIS AT HOME! For educational purposes only.
    5. // String provides no guarantees about its layout, so this could lead to
    6. unsafe {
    7. let (capacity, ptr, len): (usize, usize, usize) = std::mem::transmute(s1);
    8. println!("ptr = {ptr:#x}, len = {len}, capacity = {capacity}");
    9. }