< 返回版块

挺肥 发表于 2020-03-18 22:14

Tags:rust日报;

苹果招募 Rust 程序员

Rust Search Extension : 最好用的 Rust 搜索插件

demonstration.gif

地址:https://rust-search-extension.now.sh/

doc.rs 现在允许选择 build 目标平台

例如 winapi 只有两个目标平台:x86_64-pc-windows-msvci686-pc-windows-msvc ,那就可以这样配置:

[package.metadata.docs.rs]
# This also sets the default target to `x86_64-pc-windows-msvc`
targets = ["x86_64-pc-windows-msvc", "i686-pc-windows-msvc"]

详情:https://blog.rust-lang.org/2020/03/15/docs-rs-opt-into-fewer-targets.html

parallel_stream:数据并行库

为 async std 开发的数据并行库,使用方式如下:

use parallel_stream::prelude::*;

#[async_std::main]
async fn main() {
    // Create a vec of numbers to square.
    let v = vec![1, 2, 3, 4];

    // Convert the vec into a parallel stream and collect each item into a vector.
    let mut res: Vec<usize> = v
        .into_par_stream()
        .map(|n| async move { n * n })
        .collect()
        .await;

    // Items are stored as soon as they're ready so we need to sort them.
    res.sort();
    assert_eq!(res, vec![1, 4, 9, 16]);
}

详情:https://blog.yoshuawuyts.com/parallel-stream/


From 日报小组 @挺肥

社区学习交流平台订阅:

评论区

写评论
phper-chen 2020-03-19 10:51

👍👍👍👍👍👍👍👍

1 共 1 条评论, 1 页