【Rust每日新闻】 2018-12-31

in rust •  6 years ago 

「视频」如何在Rust,go,C#,Swift,Haskell和OCaml中编写PCIe驱动程序

#pcie #drivers

来自refreshing memories大会的演讲,编写用户态驱动程序。之前我介绍过的ixy-rs项目。


Seed发布0.2版本

#wasm

Rust的前端框架Seed发布0.2版本

seed


Rust+WASM实现react/redux风格的编程案例

#wasm

以一个简单的计数示例来展示用Rust实现react/redux风格的编程,实现虚拟dom。

virtual-dom-rs-counter


graphql_client发布0.6版本

#graphql

新版本中增加了graphql_client_web,可以支持在浏览器中通过wasm调用Graphql API。

Read More


从C迁移到Rust的心得

#C

该作者将名叫dwmstatus的C库用Rust重新实现,并在Reddit中分享了他的心得:

  • 能够访问比C中更高级别的抽象使我的生活变得轻松。特别是,原始的C代码分配了许多静态大小的缓冲区,这些缓冲区足够大以容纳必要的字符串。在Rust中不需要这样的东西。错误处理也更清晰,更明确。

  • Rust的强类型系统显示了在C代码中集中在一起的错误路径。例如,在原始C代码中,解析文件内容的失败将与未能读取文件的情况混为一谈。两种情况都以相同的方式处理,但Rust让我明确地处理它们。我更喜欢这种方式。这将使将来分离这些分支变得更容易。

  • 编译时间可以忽略,原始C代码在几分之一秒内编译,而生锈代码最多只需3-4秒即可在更改一个文件后重新编译。

  • 二进制大小要大得多 : C二进制文件是42 KB,而Rust发布二进制文件是2.9 MB。

  • 关于最后两点,我有一些问题。我是否正确地认为将Rust二进制文件与C二进制文件的编译时间和大小进行比较并不完全公平?

  • C二进制文件依赖于大量的libc和系统调用,这些调用更容易与Linux上的C代码接口。在Rust中,您需要导入并链接所有这些绑定。此外,大多数二进制大小(80-90%)和额外的crate都是通过解析时区名称和格式化日期时间字符串的要求引入的。 C代码依赖于系统/ libc调用来完成已经编译并出现在设备上的东西。我也可以使用不安全的系统调用,但是我选择使用更加生动的Rust解决方案,使用Rust chrono和chrono-tz crates来使代码在将来更容易移植并减少不安全的代码。

  • Reddit 讨论贴

  • rwmstatus


Techempower基准测试第17回合发布

#techempower #benchmarks

Read More


每日新闻订阅地址:

欢迎通过GitHub issues投稿。

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

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

You published more than 150 posts. Your next target is to reach 200 posts.
You published a post every day of the week

Click here to view your Board
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!

Do not miss the last post from @steemitboard:

Christmas Challenge - The party continues

Support SteemitBoard's project! Vote for its witness and get one more award!

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

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Christmas Challenge - The party continues

Support SteemitBoard's project! Vote for its witness and get one more award!