fn main() { // This is interesting... // &str annotate we are using a string literal, not creating // a string at run time. // It means the size of the tuple is known at compilation time. let x: (i32, i32, (), &str) = (1, 2, (), "hello"); // Because we know the tuple size at compilation time, (and likely // because it's allocated on the stack, we can simply copy it here. let y: (i32, i32, (), &str) = x; println!("{:?}, {:?}", x, y); // s oritinally immutable let s: String = String::from("hello, "); // Transferring ownership can be done to a mutable variable let mut s1 = s; s1.push_str("world"); println!("{}", s1); // x now is a pointer to the heap memory let x: Box = Box::new(5); // y is also a pointer let mut y: Box = Box::new(1); // Dereferencing Y address *y = 4; assert_eq!(*x, 5); }