🧀 Deref和Deref Coercion
&String==&str??? fn test(v: &str)->{ println!("{}",v); } fn main(){ let a = String::from("hello"); assert_eq!("hello",a); test(&a); } 因为在Rust中,我们知道 hello 是 str 类型 那这里 ...
&String==&str??? fn test(v: &str)->{ println!("{}",v); } fn main(){ let a = String::from("hello"); assert_eq!("hello",a); test(&a); } 因为在Rust中,我们知道 hello 是 str 类型 那这里 ...
I’m doing the exercise, rustingls iterators5 fn count_iterator(map: &HashMap<String, Progress>, value: Progress) -> usize { // map is a hashmap with String keys and Progress value...
mut in Rust let v = 1 We know that if we want to change the value v later, we have to declare v as mutable let mut v = 1; v = 2; Some articles says that mut v means v can point to other, which...
原文: https://okmij.org/ftp/papers/DreamOSPaper.html A dream of an ultimate OS Oleg Kiselyov oleg-at-okmij.org, http://okmij.org/ftp/ This is a dream, and as such, it is made of shreds of reality sh...
Table of Contents Benjamin Keep的 How Learning Works 系列(1) What no one tells you about learning faster Forgetting doesn’t work like you think What happens when you become ...
Rustlings HashMap 3 这道题来自 rustling hashmap3 A list of scores (one per line) of a soccer match is given. Each line is of the form : “,,," Example: England,France,4,2 (England scored 4 goals, Fra...
quiz2 题目 rustlings的题目好像会变。现在做的这个quiz2的题目是 // quiz2.rs // // This is a quiz for the following sections: // - Strings // - Vecs // - Move semantics // - Modules // - Enums // // Let's build a little...
案例 在看iter_mut 文档的时候 fn main() { let mut names = vec!["Bob", "Frank", "Ferris"]; for name in names.iter_mut() { *name = match name { &mut "Ferris" => "There is ...
Table of Contents 我的脑子里的不速之客 point 寄生生物是如何操纵人类与社会 假如你是一只吸虫,你现在在一只蚂蚁体内生活了一段时间,但你只能在羊的胆管里进行有性繁殖,而蚂蚁并不在羊的日常菜单上,那么你该如何到达下一个目的地呢? 麦地那龙线虫 疟原虫 FINISHED 我的脑...
Here we create a project named modtest My goal is that functions in test2 can refer to the functions defined in test1 test1.rs: pub fn test1_foo() { println!("test1 foo"); } test2.rs: mod...