~/WORKDIR/gamelife1314.github.io on source! ⌚ 13:15:25 $ uname -pvm Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000 arm64 arm
~/WORKDIR/gamelife1314.github.io on source! ⌚ 13:15:38 $ gcc -dumpmachine arm64-apple-darwin21.4.0
linux aarch64:
1 2 3 4 5
ubuntu@vm-docker:~$ gcc -dumpmachine aarch64-linux-gnu ubuntu@vm-docker:~$ uname -pvm #40-Ubuntu SMP Mon Mar 7 08:06:10 UTC 2022 aarch64 aarch64 ubuntu@vm-docker:~$
use std::collections::HashMap; typeTable = HashMap<String, Vec<String>>;
fnshow(table: Table) { for (artist, works) in table { println!("works by {}:", artist); forworkin works { println!(" {}", work); } } }
fnmain() { letmut table = Table::new(); table.insert("Gesualdo".to_string(), vec!["many madrigals".to_string(), "Tenebrae Responsoria".to_string()]); table.insert("Caravaggio".to_string(), vec!["The Musicians".to_string(), "The Calling of St. Matthew".to_string()]); table.insert("Cellini".to_string(), vec!["Perseus with the head of Medusa".to_string(), "a salt cellar".to_string()]); show(table); }
error[E0382]: borrow of moved value: `table`
--> src/main.rs:24:16
|
13 | let mut table = Table::new();
| --------- move occurs because `table` has type `HashMap<String, Vec<String>>`, which does not implement the `Copy` trait
...
23 | show(table);
| ----- value moved here
24 | assert_eq!(table["Gesualdo"][0], "many madrigals");
| ^^^^^ value borrowed here after move
/Users/fudenglong/.cargo/bin/cargo run --color=always --package mandelbrot --bin mandelbrot
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
Running `target/debug/mandelbrot`
thread 'main' panicked at 'attempt to divide by zero', src/main.rs:7:5
stack backtrace:
0: rust_begin_unwind
at /rustc/4ca19e09d302a4cbde14f9cb1bc109179dc824cd/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/4ca19e09d302a4cbde14f9cb1bc109179dc824cd/library/core/src/panicking.rs:142:14
2: core::panicking::panic
at /rustc/4ca19e09d302a4cbde14f9cb1bc109179dc824cd/library/core/src/panicking.rs:48:5
3: mandelbrot::pirate_share
at ./src/main.rs:7:5
4: mandelbrot::main
at ./src/main.rs:2:5
5: core::ops::function::FnOnce::call_once
at /rustc/4ca19e09d302a4cbde14f9cb1bc109179dc824cd/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Process finished with exit code 101