- Rust Standard Library Cookbook
- Jan Nils Ferner Daniel Durante
- 273字
- 2021-08-27 19:45:09
Introduction
Rust provides a very broad set of collections to use. We will look at most of them, see how they're used, discuss how they're implemented, and when to use and choose them. A big part of this chapter focuses on iterators. Much of Rust's flexibility comes from them, as all collections (and more!) can be used as iterators. Learning how to use them is crucial.
Throughout this chapter, we are going to use the big O notation to show how effective certain algorithms are. In case you don't know it yet, it is a way of telling how much longer an algorithm takes when working with more elements. Let's look at it briefly.
means that an algorithm is going to take the same time, no matter how much data is stored in a collection. It doesn't tell us how fast exactly it is, just that it's not going to slow down with size. This is the realistic ideal for a function. A practical example for this is accessing the first number in an infinite list of numbers: no matter how many numbers there are, you're always going to be able to instantly pick out the first one.
means that an algorithm is going to slow down by the same degree for every element. This is not good, but still okay. An example for this is printing all data in a for loop.
is really bad. It tells us that an algorithm is going to be slower and slower with every element. An example of it would be accessing data in a for loop nested in another for loop over the same data.
- 通信網(wǎng)圖論及應(yīng)用
- 通信線路工程設(shè)計(jì)、施工與維護(hù)(第2版)
- 大話(huà)無(wú)線室內(nèi)分布系統(tǒng)
- 移動(dòng)互聯(lián)網(wǎng):原理、技術(shù)與應(yīng)用
- 電子技術(shù)工程訓(xùn)練
- iOS應(yīng)用開(kāi)發(fā)最佳實(shí)踐
- 路由器/交換機(jī)項(xiàng)目實(shí)訓(xùn)教程
- 通信電子線路
- 視頻精講:PADS 2007原理圖與布板設(shè)計(jì)典型實(shí)例
- Network Programming with Rust
- 5G創(chuàng)新技術(shù)與行業(yè)實(shí)踐
- PTN分組傳送設(shè)備組網(wǎng)與實(shí)訓(xùn)(第2版)
- 元器件檢測(cè)技能零基礎(chǔ)成長(zhǎng)
- DSP控制器原理與技術(shù)應(yīng)用
- 通信系統(tǒng)導(dǎo)論