Macro prt! to explore memory allocation
examples/macros/macro-prt/src/main.rs
macro_rules! prt { ($var:expr) => { println!( "{:2} {:2} {:p} {:15?} '{}'", $var.len(), $var.capacity(), &$var, $var.as_ptr(), $var ); }; } fn main() { let string1 = String::from("Rust"); prt!(string1); }
4 4 0x7ffd119a2c90 0x57b54274fb80 'Rust'