ITPub博客

首页 > 数据库 > 数据库开发技术 > 【Rust日报】2020-10-19 通过 本福特定律 来学习 Rust

【Rust日报】2020-10-19 通过 本福特定律 来学习 Rust

原创 数据库开发技术 作者:Rust语言中文社区 时间:2020-10-19 22:52:44 0 删除 编辑

通过本福特定律来学习 Rust

本福特定律,也称为本福特法则,说明一堆从实际生活得出的数据中,以1为首位数字的数的出现概率约为总数的三成,接近直觉得出之期望值1/9的3倍。推广来说,越大的数,以它为首几位的数出现的概率就越低。它可用于检查各种数据是否有造假。(来自百度百科)
这篇文章通过验证本福特定律的方式来学习 Rust (入门级).
大纲如下:
  • 本福特定律 介绍
  • Installing Rust
  • Setting up the Project
  • Reading the Dataset
  • Logging
  • Parsing the Dataset
  • Comparing Results
  • Error Handling
  • Command Line Arguments
  • 总结
原文链接:https://gliderkite.github.io/posts/learn-rust-with-benford/

shared-arena: 一个线程安全的 memory pool

shared-arena 是一个 memory pool. 当不停的申请和释放大量的相同 size 的数据时, memory pool 可以有效的减少 allocating 和 deallocating 的时间.
github地址:https://github.com/sebastiencs/shared-arena

xshell: Rust 中优雅的编写调用 bash 脚本

xshell 是一个 Rust 库, 可以让你在 Rust 中优雅的调用和编写 bash 脚本.
跨平台, 让你专注于 shell 脚本的编写.
use xshell::{cmd, read_file};

let name = "Julia";
let output = cmd!("echo hello {name}!").read()?;
assert_eq!(output, "hello Julia!");

let err = read_file("feeling-lucky.txt").unwrap_err();
assert_eq!(
err.to_string(),
"`feeling-lucky.txt`: no such file or directory (os error 2)",
);
github地址:https://github.com/matklad/xshell

timed: 使用宏来profile你的程序

timed 是一个新的 profiling 工具, 主要使用宏来标记需要 profile 的函数等.
具有以下特性:
  • 支持 main
  • 支持 async
  • 支持多种 printer, 例如 println!, info! 或者其他自定义.
  • 支持chrome中的 tracing 展示结果.
github地址:https://github.com/y2kappa/timed
--
From 日报小组 BobQin,FBI小白
社区学习交流平台订阅:
  • Rustcc论坛: 支持rss
  • 微信公众号:Rust语言中文社区

原文作者:Rust语言中文社区;如有侵权,请联系管理员删除。

请登录后发表评论 登录
全部评论

注册时间:2020-06-11

  • 博文量
    1769
  • 访问量
    718604