Values & References11 / 18
Up next

Box: an owned heap pointer

fn main() {
    // Box puts the value on the heap and owns it
    let boxed = Box::new(42);
    // deref to use the inner value
    println!("{}", *boxed + 1);
}
What you're solving

Box<T> owns data on the heap