rust-dev 邮件列表存档已上线
rust-dev 邮件列表存档具有历史意义。但长期以来,网络上没有公开的存档。
caml-list(用于 OCaml)的情况类似(请参阅 discuss.ocaml.org 上的讨论 ),但 Leah Neukirchen 慷慨地使用 public-inbox 托管了存档。
我请 Leah 也托管一下 rust-dev 的存档,她同意了!现在它已经上线了,供大家进行历史研究。存档本身由 Brian Anderson 保存(非常感谢),来源:https://github.com/brson/rust-dev-archives。
网站:https://inbox.vuxu.org/rust-dev/
Reddit:https://www.reddit.com/r/rust/comments/1lygxp8/rustdev_mailing_list_archive_is_online/
文章《Hello FFI: Foot guns at the labs》
文章探讨了 Rust 和 C 之间的外部函数接口(FFI)问题,尤其是 long
类型在不同平台上的差异。
作者通过尝试调用 C 的 labs
函数(计算绝对值)来展示问题。
在 Rust 中,c_long
类型在不同平台上可能对应 i32
或 i64
,这导致在不同操作系统上编译时可能出现类型不匹配错误。
例如,macOS 和 Linux 上 c_long
是 64 位,而 Windows 上是 32 位。
作者指出,如果在 FFI 边界错误声明了类型,可能会导致未定义行为(UB),尤其是在 Windows 上,这可能导致运行时错误。
文章强调,在 FFI 中应使用 std::ffi::c_long
等类型以确保跨平台兼容性,并建议在多个平台上编译和测试代码。
Reddit:https://www.reddit.com/r/rust/comments/1lyjok1/hello_ffi_foot_guns_at_the_labs/
Rougenoir:Linux 内核红黑树的 Rust 实现
其主要动机是需要一棵平衡树,并在重新平衡时进行回调(例如用于区间树)。
我想要一个带回调的红黑树,但找不到任何能满足我需求的实现。
最终,我偶然发现了 Linux 内核的实现,觉得这是一个尝试 unsafe Rust 的机会……于是我就这么做了。
仓库:https://github.com/stackmystack/rougenoir
Reddit:https://www.reddit.com/r/rust/comments/1lyad9b/rougenoir_a_clone_of_the_linux_kernels_redblack/
Hn-rs:Hacker News 的 TUI 客户端
hn-rs
是一个用 Rust 编写的 Hacker News 终端用户界面(TUI)客户端,用户可以在终端中浏览 Hacker News 的文章、阅读文章内容和查看评论。
它支持浏览不同板块的故事、查看文章全文、阅读嵌套评论,并且操作流畅,有熟悉的按键绑定,适合与 neovim 和 tmux 搭配使用。
项目旨在减少在终端和 GUI 应用之间的切换,同时帮助作者练习 Rust。
仓库:https://github.com/Fatpandac/hn-rs
讨论:为什么 Rust 不允许自引用?
Reddit:https://www.reddit.com/r/rust/comments/1ly2ovv/why_are_self_referential_structs_disallowed/
讨论:你使用 Rust 开发什么?
Reddit:https://www.reddit.com/r/rust/comments/1lyo284/what_do_you_develop_with_rust/
-- From 日报小组 苦瓜小仔
社区学习交流平台订阅:
评论区
写评论还没有评论