< 返回版块

苦瓜小仔 发表于 2025-06-23 10:47

Tags:日报

Rust 设计讨论:In-place initialization

Alice 的 in-place initialization 提议,可解决如下问题

  • Stack overflow when creating values on the heap -> 直接在堆上分配,而不再从栈移动到堆
  • Constructors returning pinned values -> 解决 Linux 内核极其常见的链表构造问题
  • C++ move constructors
  • Async fn in dyn Trait (AFIDT)

资料:

Reddit:https://www.reddit.com/r/rust/comments/1lhqms1/experiment_proposal_inplace_initialization/

文章《Arduino Uno R4 Rust》

作者:Dom Wilson

文章介绍了在Arduino Uno R4(基于Renesas ARM Cortex M4的开发板)上使用Rust编程的过程。

作者从项目搭建开始,使用cortex-m-quickstart模板创建项目,配置了目标三元组和内存布局文件。

在编译和烧录过程中,作者遇到了一些问题,如错误地覆盖了Arduino引导程序导致设备变砖,但通过E2-lite调试器恢复了设备。

之后,作者尝试让LED闪烁,发现程序运行速度异常缓慢,通过阅读数据手册发现是配置问题。

最后,作者成功实现了通过串口发送和接收数据,并计划进一步改进代码,实现更多功能。

阅读:https://domwil.co.uk/posts/uno-r4-rust/

Reddit:https://www.reddit.com/r/rust/comments/1lhq6k5/rust_on_an_arduino_uno_r4/

文章《Adding linear-time lookbehinds to RE2》

作者:Erik Giorgis

文章介绍了如何在RE2线性时间正则表达式引擎中添加无捕获的后视(lookbehind)功能。

文章首先回顾了现代正则表达式的复杂性,尤其是后视功能,以往通常需要使用回溯算法,这可能导致指数级的时间复杂度。

2023年,研究人员证明后视可以在线性时间内匹配。文章详细描述了在RE2中实现这一功能的具体步骤,包括对解析器、编译器、NFA引擎等的修改,并展示了测试结果,证明了该实现的线性时间复杂度。

阅读:https://systemf.epfl.ch/blog/re2-lookbehinds/

Reddit:https://www.reddit.com/r/rust/comments/1lhxekl/adding_lineartime_look_behinds_to_re2/

Tabiew:发布 0.10.0

轻量级 TUI 应用程序,用于查看和查询表格数据文件,例如 CSV、TSV 和 parquet。

功能:

  • ⌨️ Vim 风格的键绑定
  • 🛠️ SQL 支持
  • 📊 支持 CSV、Parquet、JSON、JSONL、Arrow、FWF、Sqlite 和 Excel
  • 🔍 模糊搜索
  • 📝 脚本支持
  • 🗂️ 多表功能

在新版本中:

  • 主题定制
  • Excel 文件支持
  • 更好的日期和日期时间推断

仓库:https://github.com/shshemi/tabiew

Reddit:https://www.reddit.com/r/rust/comments/1lhsku1/tabiew_0100_released/

Crossfig:跨板条箱编译时 feature 反射

crossfig 是一个用于辅助管理条件编译的 crate。

其灵感源自 cfg_aliases 、 cfg-if 以及仅限夜间使用的 cfg_match 。

此 crate 的独特之处在于它无需 build.rs 或 proc-macros 即可定义别名 ,并且能够导出别名以用于您的公共 API。

crossfig 没有依赖项,没有 proc-macros,没有 build.rs ,可以使用 std 、 alloc 甚至在 Nightly 版本中不使用 core 进行编译。它完全使用 macro_rules 宏构建。

crossfig::alias! {
    /// Indicates whether the `std` feature is enabled.
    pub std: { #[cfg(feature = "std")] }
}

crossfig::switch! {
    std => {
        extern crate std;
        std::println!("Can use std!");
    }
    _ => {
        // no_std
    }
}

仓库:https://github.com/bushrat011899/crossfig

Reddit:https://www.reddit.com/r/rust/comments/1lhkjta/crossfig_crosscrate_compiletime_feature_reflection/

--

From 日报小组 苦瓜小仔

社区学习交流平台订阅:

评论区

写评论

还没有评论

1 共 0 条评论, 1 页