【Rust日报】一本新书:黑帽Rust

2024 Rust中国大会大会将于 9 月 07 日 - 08 日在上海举办。精彩议题逐步放出中,欢迎大家面对面交流。

2024 Rust中国大会报名链接暨第一批精彩演讲主题介绍

2024 Rust中国大会第二批精彩演讲主题列表

2024 Rust中国大会第三批精彩演讲主题列表

马尔科夫文本生成算法
let training_path = "data";

// Gets the paths of evey file and directory in the training_path.
let tpaths = fs::read_dir(training_path)
 .unwrap_or_else(|_| panic!("Can't read files from: {}", training_path));

// Only the files remain
let files = tpaths
 .filter_map(|f| f.ok())
 .filter(|f| match f.file_type() {
  Err(_) => false,
  Ok(f) => f.is_file(),
 });

// Reads every file into a string
let contents = files.filter_map(|f| read_to_string(f.path()).ok());

// Creating the Markov Chain
let markov_chain = contents.fold(
 MarkovChain::with_capacity(2, 8_000_000, Regex::new(WORD_REGEX).unwrap()),
 |mut a, s| {
  a.add_text(&s);
  a
 },
);

// Number of tokens
println!("{}", markov_chain.len());

// Generation
for _ in 0..10 {
 println!("{}", markov_chain.generate_start("among the       ", 25).unwrap());
}

https://github.com/Brogolem35/markov_str

Runnables CLI - 在工作区下运行可执行文件的TUI工具

在Rust的工作区中,常常有多个可执行文件,比如很多examples什么的。这时,这个工作有助于减少打字量。

92134c6ca6a297a7df54d411fd6fff02.png

https://crates.io/crates/runnables-cli

一本新书:黑帽Rust

用Rust实现软件攻防。

873fbe5c92aa0c4dbd6e9f13e122d05b.png

https://kerkour.com/black-hat-rust

trippy - 网络路由工具

已超3k+ stars.

45a05250b9d98de461728fb4cdb1c3eb.png

https://github.com/fujiapple852/trippy

--

From 日报小组 Mike

社区学习交流平台订阅:

  • Rustcc论坛: 支持rss

  • 微信公众号:Rust语言中文社区

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值