【Rust日报】 2019-06-09

in #rust7 years ago

Erst - ERB/JSP 那种 <% %> 的模板引擎

Rust 中的模板渲染引擎已经有不少了,这一个是支持 ERB/JSP 渲染语法的库。

Repo

globber - 扩展的通配模式匹配库

glob 模式是这样一些:

// Wildcards

let pattern = Pattern::new("*.rs").unwrap();
assert!(pattern.matches("hey.rs"));
assert!(!pattern.matches("hey.c"));
assert!(pattern.matches("/src/test.rs"));
assert!(!pattern.matches("/src/test.c"));

// Ranges

let pattern = Pattern::new("[a-z].rs").unwrap();
assert!(pattern.matches("a.rs"));
assert!(pattern.matches("d.rs"));
assert!(pattern.matches("z.rs"));
assert!(!pattern.matches("A.rs"));
assert!(!pattern.matches("Z.rs"));
assert!(!pattern.matches("0.rs"));

globber 是实现这些功能的一个 Rust 库,它提供了对字符串的匹配功能。目前还没有支持文件目录查找,正在进行中。

Repo

plotters - Rust 图表库 v0.2 发布

它支持多后端:位图、矢量图、windows和 webassembly。来看看效果,相当不错

img
img
img
img
img
img
img

Repo

numeric_literals - 数字字面量库

这个对科学计算应该非常有用。它做如下工作:

extern crate num;
use num::Float;

fn golden_ratio<T: Float>() -> T {
    ( T::one() + T::sqrt(T::from(5).unwrap())) / T::from(2).unwrap()
}

这种写法,简化成这种:

use numeric_literals::replace_numeric_literals;

#[replace_numeric_literals(T::from(literal).unwrap())]
fn golden_ratio<T: Float>() -> T {
   (1 + T::sqrt(5)) / 2
}

Repo

stego - 网络隐写术界的瑞士军刀

网络隐写术就是这种,比如把有用的信息,编码到一个图片中,把图片发送给别人,达到传递隐藏信息的目的。哇,终于见到Rust写的这种库了!

Repo


From 日报小组 @Mike

日报订阅地址:

独立日报订阅地址:

社区学习交流平台订阅:

Sort:  

Congratulations @blackanger! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published a post every day of the week

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Vote for @Steemitboard as a witness to get one more award and increased upvotes!