Review
很难通过某种单一的方式,就能get到所有Rust技能,学习的方式方法要多样化:
循序渐进的系统性学习(内存管理->类型系统->所有权)
主题学习(异步、宏)
交流学习(开发者大会、社区)
刻意练习(LeetCode)
刚刚结束的首届Rust China Conf 2020就是一种交流学习的方式。Rust中文社区采用直播并提供视频回放,为所有Rustacean提供了绝佳的、宝贵的学习资料。
本篇回撸一把《浅谈Rust在算法题和竞赛中的应用》,琳琅满目的特性和应用,让人爱不释手。
Speaker: Wu Aoxiang (吴翱翔)
视频:Day2 ,03:54:00~04:20:00
很实用的迭代器能力,标准库的注释如下:
Creates an iterator which can use [peek](https://doc.rust-lang.org/std/iter/struct.Peekable.html%23method.peek) to look at the next element of the iterator without consuming it.
fn peekable(self) -> Peekable
let xs = [1, 2, 3];
let mut iter = xs.iter().peekable();
// peek() lets us see into the future
assert_eq!(iter.peek(), Some(&&1))