双冒号是Rust中函数引用的标志,代码String::from("hello");
意思是引用String中的from函数,这个函数通常用来构建一个字符串对象。
let s1 = String::from("hello");
let s2 = s1;
println!("s1: {}", s1);
双冒号是Rust中函数引用的标志,代码String::from("hello");
意思是引用String中的from函数,这个函数通常用来构建一个字符串对象。
let s1 = String::from("hello");
let s2 = s1;
println!("s1: {}", s1);