Repositories (1)
geek-rust
5 snippets stored for this repo
/// 二者都可以使用 await 来执行,也可以将其提供给一个 executor 来执行
#[tokio::main]
async fn main() {
let name1 = "bitch".to_string();
let name2 = "fuck".to_string();
// 捕获 &mut name
let mut c = || {
name.push_str(" bitch");
println!("c: {}", name);
};
// to_string converts a given value to string
let name = "bitch".to_string();
let handle = thread::spawn(move || {
println!("{}", name);
panic!("bitch")
});
}
fn main() {
let input = r#"{"name": "bitch", "age": 19}"#;
let user: User = serde_json::from_str(input).unwrap();