+演算子によるStringとu32の結合(無理)
2022/2/19 15:24:00
String
とu32
の結合
fn main() {
let s1 = String::from("Hello, ");
let s2 = 1234;
let s3 = s1 + &s2; // error!!!
println!("{}", s3);
}
error[E0308]: mismatched types
--> src\main.rs:4:19
|
4 | let s3 = s1 + &s2; // error!!!
| ^^^ expected `str`, found integer
|
= note: expected reference `&str`
found reference `&{integer}`