0
点赞
收藏
分享

微信扫一扫

【Rust日报】 2019-09-03 Fac——能够自动解决依赖问题的通用编译工具

Fac——能够自动解决依赖问题的通用编译工具

如果在编译工程的时候未正确指定依赖项,Fac可以在多次尝试之后将工程成功编译。

该项目创立于2014年,最开始用C编写,2017年后开始使用rust。

Fac的灵感来自于通用编译工具make,它利用ptrace来枚举所有依赖项,并将所有源文件添加到(git)repo中。Fac的一个重要特性是它能够自动处理依赖关系,而不会像传统的编译工具一样在工程的依赖性上报错。目前,fac仅能够在Linux系统上运行,但它非常易于使用。

Read More: https://github.com/droundy/fac http://physics.oregonstate.edu/~roundyd/fac

选择性抗锯齿像素算法

始终一致地应用抗锯齿处理图像非常耗费资源,因此通过这个算法可以将此过程轻松实现自动化选择。

大致步骤分为:

  1. 给定像素一个完整的线条
  2. 计算每1 px宽块的长度和方向
  3. 针对每个像素块,将一定长度的一部分颜色变为其他颜色
/// selectively anti-alias a pixel perfect line
/// each segment of length l contains floor(l*k) number of $alt_color pixels
pub fn selective_antialias(path: &mut Pixels, k: f64, alt_color: Color) {
let mut chunks = vec![];
let mut start_idx = 0;
for (i, (pi,pj)) in path.iter().zip(path.iter().skip(1)).enumerate() {
// if consecutive pixels not connected
if (pi.point.x != pj.point.x) && (pi.point.y != pj.point.y) {
let start_pix = path.0.get_index(start_idx).unwrap();
let dir = start_pix.dir(&pi);
chunks.push((i - start_idx, dir));
start_idx = i + 1;
}
}
let start_pix = path.0.get_index(start_idx).unwrap();
let dir = start_pix.dir(path.iter().last().unwrap());
chunks.push(((path.len() - start_idx - 1), dir));
assert_eq!(chunks.iter().map(|i|i.0 + 1).sum::<usize>(), path.len());
let mut idx = 0;
for (l, dir) in chunks {
for j in 0..=l {
// xor with dir to keep orientation of coloring
// example:
// o o
// o o
// x x
// x x
// ooxx
if (j <= (l as f64 * k) as usize) ^ dir {
let p = path.0.get_index(idx).unwrap().with_color(alt_color);
path.0.replace(p);
} else {
// noop
}
idx += 1;
}
}
}

Read More: Ricky Han blog

rxRust 0.2发布

rxrust是一个Rust实现的Reactive Extensions。ReactiveX是一个用于通过使用可观察序列来编写异步和基于事件的程序的库。除了对象必须将流的第一个闭包打包之外,他几乎是0开销的。

它扩展了观测模式以支持数据“与/或”事件序列,并添加了允许以声明方式组合序列的运算符,同时抽象出对低级线程同步、线程安全、并行数据结构和无阻塞I / O等问题的补充。

Read More: https://github.com/M-Adoo/rxRust/blob/master/CHANGELOG.md

Reactive Extensions官网:http://reactivex.io/

Helm本月迎来第一批用户

heim是用于系统信息获取的Rust跨平台异步库,已经发布一个多月,能够获取Rust crates生态系统中的系统信息(例如,CPU,内存,磁盘或进程统计)。

heim 有几个关键目标来奠定他的发展基础和公共接口:1.异步优先 2.跨平台。3.模块化设计。4.符合用户习惯且易于上手。

现在可以使用新模块​​heim::process​​查询系统进程:

let current = heim::process::current().await?;

let mut processes = heim::process::processes();
while let Some(process) = processes.next().await {
let process = process?;

println!("Pid: {}", process.pid());
if process.pid() == current.pid() {
println!("It's-a me, Mario!");
}

println!("Status: {:?}", process.status().await?);
println!("Name: {}", process.name().await?);
println!("Path to executable: {:?}", process.exe().await?);
// …and many other methods available
}

Read More: https://github.com/heim-rs/heim/

Rust游戏开发工作组(非官方)工作月报

看看这个月发布了什么新的rust小游戏:

Way of Rhea Trailer and Steam Wishlist

【Rust日报】 2019-09-03 Fac——能够自动解决依赖问题的通用编译工具_github

Veloren 0.3

【Rust日报】 2019-09-03 Fac——能够自动解决依赖问题的通用编译工具_github_02


RUZZT

【Rust日报】 2019-09-03 Fac——能够自动解决依赖问题的通用编译工具_github_03


还有更多:https://rust-gamedev.github.io/2019/09/02/newsletter-001.html


日报订阅地址:

独立日报订阅地址:

  • Telgram Channel
  • 阿里云语雀订阅
  • Steemit
  • GitHub

社区学习交流平台订阅:

  • Rust.cc论坛: 支持rss
  • Rust Force: 支持rss
  • 微信公众号:Rust语言学习交流


举报

相关推荐

0 条评论