Skip to content

Rust Meme

HOA PHAN edited this page Feb 25, 2024 · 1 revision

source: main.rs

struct A(u32);

fn print_a(a: &A) {
    println!("A: {}", a.0);
}

fn main() {
    let a = A(10);
    print_a(&a);
    print_a(&a);
}

7.95s

cargo build
   Compiling borrowing v0.1.0 (borrowing)
    Finished dev [unoptimized + debuginfo] target(s) in 7.95s

cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/borrowing`
A: 10
A: 10

eye

Clone this wiki locally