Rust 在这个领域要大放异彩:一本新书推荐(附下载)
以下内容来源于逆锋起笔,关注每日干货及时送达
据说学 Rust 的人中,有不少是前端的,主要是很多前端工具链采用 Rust 重写。不仅如此,终端命令工具,也有很多 Rust 的轮子。所以,学学 Rust 造 command line 工具的轮子,对学习 Rust 挺好。
前几天发现有一本专门讲解 Rust 实现命令行工具的书,推荐给大家。
https://www.oreilly.com/library/view/command-line-rust/9781098109424/
这本书不是专注于整个语言,而是在每一章中使用一个小型、完整的程序来讲解 Rust。作者 Ken Youens-Clark 向你展示了如何启动、编写和测试每个程序以创建成品。你将学习如何处理 Rust 中的错误、读写文件以及使用正则表达式、Rust 类型、结构等等。
本书的目录如下:
1. Truth or Consequences
Getting Started with “Hello, world!”
Organizing a Rust Project Directory
Creating and Running a Project with Cargo
Writing and Running Integration Tests
Adding a Project Dependency
Understanding Program Exit Values
Testing the Program Output
Exit Values Make Programs Composable
Summary
2. Test for Echo
How echo Works
Getting Started
Accessing the Command-Line Arguments
Adding clap as a Dependency
Parsing Command-Line Arguments Using clap
Creating the Program Output
Writing Integration Tests
Creating the Test Output Files
Comparing Program Output
Using the Result Type
Summary
3. On the Catwalk
How cat Works
Getting Started
Starting with Tests
Creating a Library Crate
Defining the Parameters
Iterating Through the File Arguments
Opening a File or STDIN
Using the Test Suite
Solution
Reading the Lines in a File
Printing Line Numbers
Going Further
Summary
4. Head Aches
How head Works
Getting Started
Writing a Unit Test to Parse a String into a Number
Converting Strings into Errors
Defining the Arguments
Processing the Input Files
Reading Bytes Versus Characters
Solution
Reading a File Line by Line
Preserving Line Endings While Reading a File
Reading Bytes from a File
Printing the File Separators
Going Further
Summary
5. Word to Your Mother
How wc Works
Getting Started
Iterating the Files
Writing and Testing a Function to Count File Elements
Solution
Counting the Elements of a File or STDIN
Formatting the Output
Going Further
Summary
6. Den of Uniquity
How uniq Works
Getting Started
Defining the Arguments
Testing the Program
Processing the Input Files
Solution
Going Further
Summary
7. Finders Keepers
How find Works
Getting Started
Defining the Arguments
Validating the Arguments
Finding All the Things
Solution
Conditionally Testing on Unix Versus Windows
Going Further
Summary
8. Shave and a Haircut
How cut Works
Getting Started
Defining the Arguments
Parsing the Position List
Extracting Characters or Bytes
Parsing Delimited Text Files
Solution
Selecting Characters from a String
Selecting Bytes from a String
Selecting Fields from a csv::StringRecord
Final Boss
Going Further
Summary
9. Jack the Grepper
How grep Works
Getting Started
Defining the Arguments
Finding the Files to Search
Finding the Matching Lines of Input
Solution
Going Further
Summary
10. Boston Commons
How comm Works
Getting Started
Defining the Arguments
Validating and Opening the Input Files
Processing the Files
Solution
Going Further
Summary
11. Tailor Swyfte
How tail Works
Getting Started
Defining the Arguments
Parsing Positive and Negative Numeric Arguments
Using a Regular Expression to Match an Integer with an Optional Sign
Parsing and Validating the Command-Line Arguments
Processing the Files
Counting the Total Lines and Bytes in a File
Finding the Starting Line to Print
Finding the Starting Byte to Print
Testing the Program with Large Input Files
Solution
Counting All the Lines and Bytes in a File
Finding the Start Index
Printing the Lines
Printing the Bytes
Benchmarking the Solution
Going Further
Summary
12. Fortunate Son
How fortune Works
Getting Started
Defining the Arguments
Finding the Input Sources
Reading the Fortune Files
Randomly Selecting a Fortune
Printing Records Matching a Pattern
Solution
Going Further
Summary
13. Rascalry
How cal Works
Getting Started
Defining and Validating the Arguments
Writing the Program
Solution
Going Further
Summary
14. Elless Island
How ls Works
Getting Started
Defining the Arguments
Finding the Files
Formatting the Long Listing
Displaying Octal Permissions
Testing the Long Format
Solution
Notes from the Testing Underground
Going Further
Summary
Epilogue
Index
About the Author
想要看这本的,添加微信studyingJava免费领取
推荐阅读
60 个神级 VS Code 插件!
微信内测版抢先体验,可发 4K 无损视频
豆瓣上最受关注的 10 本书(附下载)
这 5 本书,给你一次彻底读懂 Spring 的机会
下载!Java 编程必读书籍!
Rust 在这个领域要大放异彩:一本新书推荐(附下载)相关推荐
- 公路领域新型基础设施建设报告(附下载)
新型基础设施是以新发展理念为引领,以技术创新为驱动,以信息网络为基础,面向高质量发展需要,提供数字转型.智能升级.融合创新等服务的基础设施体系.主要包括信息基础设施.融合基础设施和创新基础设施三方面内 ...
- 【报告分享】聚焦游戏领域2021年回顾-AppAnnie(附下载)
如需查看完整报告和报告下载或了解更多,公众号:行业报告智库 摘要:移动游戏正在推动全球整个游戏市场的发展,在2021年,移动.游戏机.掌上游戏机和PC/Mac游戏的用户支出预计将超过2040亿美元. ...
- 出版一本新书《燃烧的岁月》
获奖证书 荣获2014年7月"文华杯"中国小说学会获奖作品精选文集 "文华杯"全国小说大赛获奖作品会刊 出版一本新书 ...
- 新书推荐 |《广告数据定量分析:如何成为一位厉害的广告优化师》
新书推荐 <广告数据定量分析:如何成为一位厉害的广告优化师> 长按二维码 了解及购买 资深广告优化师和数据分析师撰写,宋星.吴俊等近10位专家推荐,快速提升广告优化师数据分析能力,总结SE ...
- 新书推荐 |《5G NR物理层技术详解:原理、模型和组件》
新书推荐 <5G NR物理层技术详解:原理.模型和组件> 点击上图了解及购买 5G专家和学者撰写,详解5G NR物理层技术(包括波形.编码调制.信道仿真和多天线技术等)及其背后的成因,爱立 ...
- 新书推荐 |《好设计,有方法:我们在搜狐做产品体验设计》
新书推荐 <好设计,有方法:我们在搜狐做产品体验设计> 长按二维码 了解及购买 搜狐媒体UED中心团队心血力作,搜狐焦点CTO作序推荐,滴滴.携程.迅雷.宜信.腾讯等知名企业的近10位设计 ...
- 新书推荐 |《计算机安全:原理与实践(原书第4版)》
新书推荐 <计算机安全:原理与实践(原书第4版)> 长按二维码 了解及购买 深入浅出地介绍计算机安全的原理,计算机安全领域的知名教材. 编辑推荐 本书作者William Stallings ...
- 新书推荐 | OpenShift在企业中的实践:PaaS DevOps 微服务
新书推荐 <OpenShift在企业中的实践:PaaS DevOps微服务> 长按二维码 了解及购买 多位全球知名企业IT负责人联名推荐,两位红帽和亚马逊AWS云计算和微服务资深架构师和技 ...
- 新书推荐 |《OpenCV 4计算机视觉项目实战(原书第2版)》
新书推荐 <OpenCV 4计算机视觉项目实战(原书第2版)> 长按二维码 了解及购买 一本使用OpenCV进行计算机视觉应用开发的实践,指南不仅介绍OpenCV基础知识,还详细讲解各种实 ...
最新文章
- 离群点检测算法-基础概念
- DataGridView 添加ComboBox
- 一阶暂态电路三要素法和三种响应
- 雅礼集训 2017 Day1
- eclipse加载maven工程提示pom.xml无法解析org.apache.maven.plugins:maven-resources-plugin:2.4.3解决方案...
- Android 绘制动态图
- python图像锐化_Python图像处理介绍--图像模糊与锐化
- ACE网络编程思考(二)
- Spring ——《第二章》Spring中的Bean
- Ugly Number II
- React native连续按两次退出app
- atitit 碎片化学习.docx attilax 总结
- 使用rust调用c++静态库并编译nodejs包
- 汽车行业DBC文件解析 | Python 解析dbc文件
- 请问,非计算机专业,只为软考中级,哪一种最容易过?
- 基于sa866的电磁搅拌器计算机控制系统,一种新型电磁搅拌器计算机控制系统
- easypoi 语法_高中英语必修1选修8 quot;语法quot;重难点清单(全八册)
- 怎么换头像啊。。。。。
- 数据仓库设计规范文档
- matlab axis坐标轴相关设置详解
热门文章
- JavaScript 无缝连接滚动特效
- 负载均衡(Load Balance)简单介绍
- ATmega8/16/32/64/128中文参考手册
- c语言中进行大小排序的问题(少量排序)
- LC正弦波振荡器【高频电子线路】【Multisim】
- 安卓性能优化(响应优化)
- Java将前端Data Url (data:image/jpg;base64,)转为数据流
- 幸福地生活 -哈佛幸福公开课
- 【一起入门MachineLearning】中科院机器学习-期末题库-【计算题3,4】-前向算法和维特比算法手算过程
- 大数据时代如何保障数据安全