<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/feeds/style.xsl"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>burntsushi</title>
    <description>rssume processed feed for burntsushi</description>
    <link>/feeds/burntsushi</link>
    <atom:link href="/feeds/burntsushi" rel="self" type="application/rss+xml"/>
    <lastBuildDate>Thu, 4 Jun 2026 10:00:31 +0000</lastBuildDate>
    <generator>rssume</generator>
    <item>
      <title>将正则表达式引擎内部作为库</title>
      <description>[AI 摘要] 本文讨论了重写Rust正则表达式库的动机、解决方案，并介绍了将引擎内部暴露为API的新库regex-automata。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文讨论了重写Rust正则表达式库的动机、解决方案，并介绍了将引擎内部暴露为API的新库regex-automata。</div><p>过去几年，我对<a href="https://github.com/rust-lang/regex/" rel="noopener noreferrer">Rust的<code>regex</code> crate</a>进行了重写，旨在改善内部组件的组合性，使其在保证正确性的同时更易于添加优化。在此重写过程中，我创建了一个新crate：<a href="https://github.com/rust-lang/regex/tree/master/regex-automata" rel="noopener noreferrer"><code>regex-automata</code></a>，它将<code>regex</code> crate的大量内部实现作为独立API提供给他人使用。据我所知，这是首个以独立版本库形式，如此深入地暴露其内部机制的正则表达式库。</p>
<p>这篇博客文章讨论了导致此次重写的问题、重写如何解决了这些问题，并引导读者了解<code>regex-automata</code>的API。</p>
<p><strong>目标受众</strong>：Rust程序员以及任何对某个特定有限自动机正则表达式引擎实现方式感兴趣的人。假定具备正则表达式的先验知识。</p><p><em>由 mimo-v2.5 模型翻译，花费 856 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/regex-internals/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/regex-internals/</guid>
      <pubDate>Wed, 5 Jul 2023 13:06:00 +0000</pubDate>
    </item>
    <item>
      <title>面向 Rust 的字节字符串库</title>
      <description>[AI 摘要] 本文介绍了新发布的 Rust 字节字符串库 bstr 1.0，阐述其设计理念、API 及使用场景。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文介绍了新发布的 Rust 字节字符串库 bstr 1.0，阐述其设计理念、API 及使用场景。</div><p><a href="https://docs.rs/bstr/1.*" rel="noopener noreferrer"><code>bstr</code></a> 是一个面向 Rust 的字节字符串库，其 <a href="https://github.com/BurntSushi/bstr/releases/tag/1.0.0" rel="noopener noreferrer">1.0 版本刚刚发布</a>！它为任意字节序列提供了面向字符串的操作，但当这些字节是 UTF-8 编码时尤为实用。换句话说，它提供了一个按<em>约定</em>为 UTF-8 编码的字符串类型，而 Rust 内置的字符串类型则<em>保证</em>为 UTF-8 编码。</p>
<p>本文将简要描述其 API，深入探讨创建 <code>bstr</code> 的动机，展示一些使用 <code>bstr</code> 的简短示例程序，并以几点思考作为结语。</p>
<p><strong>目标读者</strong>：具备一定 UTF-8 背景知识的 Rust 程序员。</p><p><em>由 mimo-v2.5 模型翻译，花费 818 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/bstr/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/bstr/</guid>
      <pubDate>Wed, 7 Sep 2022 18:00:00 +0000</pubDate>
    </item>
    <item>
      <title>在 Rust 中使用 unwrap() 是可以的</title>
      <description>[AI 摘要] 这篇文章解释了在 Rust 中在特定情况下（如测试代码）使用 unwrap() 是可接受的，并解决了关于其使用的常见误解。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 这篇文章解释了在 Rust 中在特定情况下（如测试代码）使用 unwrap() 是可接受的，并解决了关于其使用的常见误解。</div><p>在 Rust 1.0 发布的前一天，我发布了一篇<a href="https://blog.burntsushi.net/rust-error-handling/" rel="noopener noreferrer">涵盖错误处理基础的博客文章</a>。文章中间有一个特别重要但篇幅较小的部分，标题为“<a href="https://blog.burntsushi.net/rust-error-handling/#a-brief-interlude-unwrapping-isnt-evil" rel="noopener noreferrer">unwrap 并非邪恶</a>”。该部分简要描述了，广泛来说，如果在测试/示例代码中使用 <code>unwrap()</code>，或者当 panic 表示一个 bug 时，是可以的。</p>
<p>我今天通常仍然持有这种信念。这种信念在 Rust 的标准库和许多核心生态系统 crate 中得到了实践。（而且这种实践早于我的博客文章。）然而，关于何时可以和不可以使用 <code>unwrap()</code> 似乎仍然存在广泛的混淆。这篇文章将更详细地讨论这一点，并具体回应我所看到的一些观点。</p>
<p>这篇博客文章在某种程度上写得像一个常见问题解答，但它是有意按顺序阅读的。每个问题都建立在前一个基础上。</p>
<p><strong>目标受众</strong>：主要是 Rust 程序员，但我希望提供足够的上下文，使这里倡导的原则适用于任何程序员。尽管对于具有不同错误处理机制（如异常）的语言，可能很难直接映射。</p><p><em>由 mimo-v2.5 模型翻译，花费 2103 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/unwrap/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/unwrap/</guid>
      <pubDate>Mon, 8 Aug 2022 13:00:00 +0000</pubDate>
    </item>
    <item>
      <title>System76 Darter Pro 上的 Archlinux</title>
      <description>[AI 摘要] 本文介绍了在配备 Coreboot 的 System76 Darter Pro 上安装和配置 Arch Linux 的体验，面向寻找 Linux 兼容笔记本的用户。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文介绍了在配备 Coreboot 的 System76 Darter Pro 上安装和配置 Arch Linux 的体验，面向寻找 Linux 兼容笔记本的用户。</div><p>这是一篇简短的博文，回顾我在配备 Coreboot 的 System76 Darter Pro（型号：darp6）上运行 Archlinux 的配置，以及我对这款笔记本电脑的一些总体看法。这是我自 <a href="https://blog.burntsushi.net/lenovo-thinkpad-t430-archlinux" rel="noopener noreferrer">2012 年 7 月购买 ThinkPad T430</a> 以来的首次笔记本电脑升级</p>
<p>目标读者：正在寻找兼容 Linux 笔记本电脑的 Archlinux 用户。</p><p><em>由 mimo-v2.5 模型翻译，花费 629 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/system76-darter-archlinux/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/system76-darter-archlinux/</guid>
      <pubDate>Mon, 27 Jan 2020 22:55:00 +0000</pubDate>
    </item>
    <item>
      <title>我的FOSS故事</title>
      <description>[AI 摘要] 这是一篇关于作者个人参与自由开源软件（FOSS）经历的反思文章，旨在分享故事并促进社区内的同理心。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 这是一篇关于作者个人参与自由开源软件（FOSS）经历的反思文章，旨在分享故事并促进社区内的同理心。</div><p>我想暂时跳出自己专注于技术内容的惯例，分享一点我与自由开源软件（FOSS）的个人关系。虽然每个人都不同，但我希望通过分享我的观点，帮助建立理解、同理心和信任。</p>
<p>这并非旨在直接回应任何其他维护者的行为。也不应被解读为对FOSS中某人理想行为的规范。这更多是一次个人反思，希望他人能用它来思考自己与FOSS的关系。成为优秀的FOSS维护者并无唯一正确的路径。我们都有自己的应对机制。</p>
<p>这同样绝非求助的呼吁。这是关于理解。这不是恳求改变FOSS的经济模式。这不是头脑风暴改善我的心理健康的方法。这不是为了引入更多维护者。这是分享我的故事，并试图增进FOSS社区成员之间的同理心。</p>
<p><strong>目标受众</strong>：任何参与FOSS的人。</p><p><em>由 mimo-v2.5 模型翻译，花费 796 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/foss/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/foss/</guid>
      <pubDate>Sun, 19 Jan 2020 22:15:00 +0000</pubDate>
    </item>
    <item>
      <title>Rust 与 CSV 解析</title>
      <description>[AI 摘要] 一篇面向 Rust 初学者的教程，介绍如何使用 csv 1.0 库读写 CSV 数据。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 一篇面向 Rust 初学者的教程，介绍如何使用 csv 1.0 库读写 CSV 数据。</div><p>随着 <code>csv 1.0</code> 的发布，正是撰写一篇关于如何在 Rust 中读写 CSV 数据的教程的好时机。本教程面向 Rust 初学者，因此包含大量示例，并花费一些篇幅介绍基本概念。经验丰富的 Rust 程序员可能会觉得其中部分内容有用，但快速浏览一下可能更合适。</p>
<p>关于 Rust 的入门介绍，请参阅<a href="https://doc.rust-lang.org/book/second-edition/" rel="noopener noreferrer">官方书籍</a>。如果你还没有编写过任何 Rust 代码，但在其他语言中编写过代码，那么本教程可能在你无需先阅读官方书籍的情况下也能理解。</p>
<p>CSV 库<a href="https://github.com/BurntSushi/rust-csv" rel="noopener noreferrer">可在 Github 上获取</a>，并有<a href="https://docs.rs/csv" rel="noopener noreferrer">详尽的 API 文档</a>。</p>
<p>最后，这篇博客文章的一个版本已作为<a href="https://docs.rs/csv/1.0.0/csv/tutorial/index.html" rel="noopener noreferrer">教程</a>包含在 API 文档中，并且随着时间的推移，它更有可能得到更新。</p>
<p><strong>目标读者</strong>：Rust 初学者。</p><p><em>由 mimo-v2.5 模型翻译，花费 935 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/csv/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/csv/</guid>
      <pubDate>Tue, 23 May 2017 01:01:00 +0000</pubDate>
    </item>
    <item>
      <title>ripgrep 比 {grep, ag, git grep, ucg, pt, sift} 更快</title>
      <description>[AI 摘要] 本文通过对25个基准测试的深入分析，论证了命令行工具ripgrep在性能和正确性上优于其他流行代码搜索工具。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文通过对25个基准测试的深入分析，论证了命令行工具ripgrep在性能和正确性上优于其他流行代码搜索工具。</div><p>在这篇文章中，我将介绍一个新的命令行搜索工具
<a href="https://github.com/BurntSushi/ripgrep" rel="noopener noreferrer"><code>ripgrep</code></a>，它结合了
<a href="https://github.com/ggreer/the_silver_searcher" rel="noopener noreferrer">The Silver Searcher</a>
（一个 <a href="http://beyondgrep.com/" rel="noopener noreferrer"><code>ack</code></a> 克隆版）的易用性与 GNU grep 的原始性能。<code>ripgrep</code> 速度快、跨平台（提供 Linux、Mac 和 Windows 的二进制文件），并使用 <a href="https://www.rust-lang.org" rel="noopener noreferrer">Rust</a> 编写。</p>
<p><code>ripgrep</code> 可在 <a href="https://github.com/BurntSushi/ripgrep" rel="noopener noreferrer">Github</a> 上获取。</p>
<p>我们将尝试做不可能的事：对几个流行的代码搜索工具进行公平的基准比较。具体来说，我们将深入探讨一系列 25 个基准测试，以证实以下论点：</p>
<ul>
<li>无论是搜索单个文件还是海量文件目录，其他工具在性能或正确性上都没有明显优于 <code>ripgrep</code>。</li>
<li><code>ripgrep</code> 是唯一支持 Unicode 且不会为此付出高昂代价的工具。</li>
<li>如果使用内存映射，同时搜索多个文件的工具通常<em>更慢</em>，而不是更快。</li>
</ul>
<p>作为一个在业余时间用 Rust 研究文本搜索已有 2.5 年，并且是 <code>ripgrep</code> 和 <a href="https://github.com/rust-lang-nursery/regex" rel="noopener noreferrer">底层正则表达式引擎</a> 的作者，我将借此机会深入剖析每种代码搜索工具的性能。每个基准测试都会被仔细审查！</p>
<p><strong>目标受众</strong>：熟悉 Unicode、编程并有一些命令行使用经验的读者。</p>
<p><strong>注意</strong>：我收到一些人反映，<code>rg</code> 在他们的数据上并未如我声称的那么快。我很乐意帮助解释情况，但为此，我需要能够重现你的结果。如果你能 <a href="https://github.com/BurntSushi/ripgrep/issues" rel="noopener noreferrer">提交一个 issue</a> 并提供我能重现的案例，我很乐意尝试解释。</p><p><em>由 mimo-v2.5 模型翻译，花费 1548 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/ripgrep/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/ripgrep/</guid>
      <pubDate>Fri, 23 Sep 2016 11:05:00 +0000</pubDate>
    </item>
    <item>
      <title>使用自动机与Rust索引16亿个键</title>
      <description>[AI 摘要] 本文介绍如何使用有限状态机作为高效数据结构，通过Rust的fst工具实现大规模字符串索引与快速搜索。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文介绍如何使用有限状态机作为高效数据结构，通过Rust的fst工具实现大规模字符串索引与快速搜索。</div><p>事实证明，有限状态机不仅用于表达计算。它还可用于紧凑地表示字符串的有序集合或映射，从而实现极速搜索。</p>
<p>本文将介绍如何将有限状态机作为<em>数据结构</em>来表示有序集合与映射，包括一个用Rust编写的实现——<a href="https://github.com/BurntSushi/fst" rel="noopener noreferrer"><code>fst</code> crate</a>。它提供了<a href="https://burntsushi.net/rustdoc/fst/" rel="noopener noreferrer">完整的API文档</a>。我还将演示如何使用简单的命令行工具构建这些结构。最后，将通过几个实验展示如何索引来自<a href="http://blog.commoncrawl.org/2015/08/july-2015-crawl-archive-available/" rel="noopener noreferrer">2015年7月Common Crawl归档</a>的超过16亿条URL（134GB数据）。</p>
<p>本文所述的技术也是<a href="http://blog.mikemccandless.com/2010/12/using-finite-state-transducers-in.html" rel="noopener noreferrer">Lucene构建其倒排索引部分</a>所采用的方法。</p>
<p>在此过程中，我们将探讨内存映射、基于正则表达式的自动机交集、基于Levenshtein距离的模糊搜索以及流式集合操作。</p>
<p><strong>目标读者</strong>：具备编程和基础数据结构知识，无需自动机理论或Rust经验。</p><p><em>由 mimo-v2.5 模型翻译，花费 1089 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/transducers/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/transducers/</guid>
      <pubDate>Thu, 12 Nov 2015 02:45:00 +0000</pubDate>
    </item>
    <item>
      <title>Rust 中的错误处理</title>
      <description>[AI 摘要] 本文面向 Rust 新手，全面介绍了 Rust 中基于返回值的错误处理方法，旨在帮助读者掌握标准库提供的简洁高效处理方式。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文面向 Rust 新手，全面介绍了 Rust 中基于返回值的错误处理方法，旨在帮助读者掌握标准库提供的简洁高效处理方式。</div><p>像大多数编程语言一样，Rust 鼓励程序员以特定的方式处理错误。一般来说，错误处理分为两大类：异常和返回值。Rust 选择了返回值。</p>
<p>在本文中，我打算全面介绍如何在 Rust 中处理错误。更重要的是，我将尝试逐步引入错误处理，以便您能扎实掌握所有内容如何协同运作。</p>
<p>如果以简单直接的方式编写，Rust 中的错误处理可能会显得冗长且令人烦恼。本文将探讨这些难点，并演示如何使用标准库使错误处理变得简洁且符合人体工程学。</p>
<p><strong>目标读者</strong>：那些刚接触 Rust 且尚不了解其错误处理惯用法的 Rust 新手。对 Rust 有一定熟悉程度会有所帮助。（本文大量使用了一些标准 trait 以及对闭包和宏的简单应用。）</p>
<p><strong>更新（2018/04/14）</strong>：示例已转换为使用 <code>?</code>，并添加了一些文本以提供此变更的历史背景。</p>
<p><strong>更新（2020/01/03）</strong>：移除了推荐使用
<a href="https://crates.io/crates/failure" rel="noopener noreferrer"><code>failure</code></a> 的内容，改为推荐使用
<a href="https://crates.io/crates/anyhow" rel="noopener noreferrer"><code>Box&lt;Error + Send + Sync&gt;</code></a> 或
<a href="https://crates.io/crates/anyhow" rel="noopener noreferrer"><code>anyhow</code></a>。</p><p><em>由 mimo-v2.5 模型翻译，花费 1066 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/rust-error-handling/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/rust-error-handling/</guid>
      <pubDate>Thu, 14 May 2015 14:47:26 +0000</pubDate>
    </item>
    <item>
      <title>Rust的语法扩展与正则表达式</title>
      <description>[AI 摘要] 本文介绍如何在Rust中通过语法扩展实现正则表达式编译为原生代码，并确保其与运行时编译的正则表达式API保持一致。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文介绍如何在Rust中通过语法扩展实现正则表达式编译为原生代码，并确保其与运行时编译的正则表达式API保持一致。</div><p><strong>警告：</strong> 2018-04-12：本文的代码示例已不再提供。这倒也好，因为它们都依赖于一个已多年不存在的、不稳定的内部编译器接口。</p>
<p>几周前，我着手为<a href="http://www.rust-lang.org/" rel="noopener noreferrer">Rust</a>发行版添加正则表达式支持，其实现与功能集在很大程度上受到了<a href="http://swtch.com/~rsc/regexp/" rel="noopener noreferrer">Russ Cox的RE2</a>启发。它最近已被加入<a href="http://static.rust-lang.org/doc/master/regex/index.html" rel="noopener noreferrer">Rust发行版</a>。</p>
<p>这个正则表达式crate包含一个语法扩展，它能在Rust程序编译时，将正则表达式编译为原生的Rust代码。这可以被视为“提前”编译，或类似于<a href="http://en.wikipedia.org/wiki/Compile_time_function_execution" rel="noopener noreferrer">编译时函数执行</a>。这些特殊的原生编译正则表达式，与在运行时编译的正则表达式拥有*完全相同*的API。</p>
<p>本文将概述我的实现策略——包括如何编写Rust语法扩展的代码示例——并描述我如何实现编译时正则表达式与运行时正则表达式之间完全一致的API。</p><p><em>由 mimo-v2.5 模型翻译，花费 1071 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/rust-regex-syntax-extensions/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/rust-regex-syntax-extensions/</guid>
      <pubDate>Mon, 21 Apr 2014 23:51:00 +0000</pubDate>
    </item>
    <item>
      <title>在Go中编写类型参数化函数</title>
      <description>[AI 摘要] 介绍一个Go工具包，用于编写能在运行时保持类型安全的类型参数化函数。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 介绍一个Go工具包，用于编写能在运行时保持类型安全的类型参数化函数。</div><p>Go中唯一能在编译期保证类型安全的方法是结构化子类型（structural subtyping），而本文并不会改变这一点。相反，我将介绍一个名为<code>ty</code>的工具包，它提供了在Go中编写类型参数化函数的工具，这些函数能在<strong>运行时</strong>保持类型安全，同时也便于调用者使用。</p><p><em>由 mimo-v2.5 模型翻译，花费 521 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/type-parametric-functions-golang/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/type-parametric-functions-golang/</guid>
      <pubDate>Sat, 6 Apr 2013 17:54:00 +0000</pubDate>
    </item>
    <item>
      <title>介绍NFLGame：以编程方式访问实时NFL比赛数据</title>
      <description>[AI 摘要] 文章介绍了一个旨在改善NFL数据获取方式的新库NFLGame。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 文章介绍了一个旨在改善NFL数据获取方式的新库NFLGame。</div><p>作为一名程序员兼梦幻橄榄球爱好者，我对获取机器可读格式数据所必须采用的方式感到尴尬。
这种开源软件的缺乏，让社区受困于低标准的工具，最重要的是，它阻碍了利用易得的统计数据去实现一些真正酷炫且有趣的设想。
许多工具要么过时，要么损坏；即使能用，也往往是闭源的，且常常收费。</p>
<p>昨天，我开始着手开发一个新的库包，希望能开始改善这一可悲的现状。</p><p><em>由 mimo-v2.5 模型翻译，花费 597 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/nfl-live-statistics-with-python/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/nfl-live-statistics-with-python/</guid>
      <pubDate>Thu, 30 Aug 2012 05:45:00 +0000</pubDate>
    </item>
    <item>
      <title>在联想Thinkpad T430上运行Archlinux</title>
      <description>[AI 摘要] 这是一篇关于在ThinkPad T430上安装和配置Archlinux的个人经验记录。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 这是一篇关于在ThinkPad T430上安装和配置Archlinux的个人经验记录。</div><p>总之，Archlinux运行得非常好。以下是在安装、配置、调优和使用Archlinux于联想Thinkpad T430过程中记录的要点概述。</p><p><em>由 mimo-v2.5 模型翻译，花费 602 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/lenovo-thinkpad-t430-archlinux/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/lenovo-thinkpad-t430-archlinux/</guid>
      <pubDate>Sun, 1 Jul 2012 05:39:00 +0000</pubDate>
    </item>
    <item>
      <title>守护进程化Go程序（附BSD风格rc.d示例）</title>
      <description>[AI 摘要] 文章介绍了Go语言因多线程特性难以传统守护进程化，建议使用nohup后台运行来解决。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 文章介绍了Go语言因多线程特性难以传统守护进程化，建议使用nohup后台运行来解决。</div><p>Go语言天生具有多线程特性。这使得通过fork方式守护进程化Go程序的传统方法变得有些困难。</p>
<p>为了解决这个问题，您可以尝试一种简单的方法：将Go程序放到后台运行，并指示其<a href="http://en.wikipedia.org/wiki/Nohup" rel="noopener noreferrer">忽略HUP信号</a>：</p><p><em>由 mimo-v2.5 模型翻译，花费 507 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/golang-daemonize-bsd/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/golang-daemonize-bsd/</guid>
      <pubDate>Sat, 28 Apr 2012 02:12:00 +0000</pubDate>
    </item>
    <item>
      <title>为X Go绑定添加线程安全性</title>
      <description>[AI 摘要] 本文讨论X Go绑定缺乏线程安全性的现状及其并行请求可能带来的问题。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文讨论X Go绑定缺乏线程安全性的现状及其并行请求可能带来的问题。</div><p><a href="http://code.google.com/p/x-go-binding/" rel="noopener noreferrer">X Go绑定 (XGB)</a>是一个底层库，它提供了与运行中的X服务器交互的API。人们只能通过网络连接发送数据来与X服务器通信；协议请求、回复和错误需要精确构造到每一个字节。Xlib正是这样做的，甚至更多。结果，Xlib变得庞大且难以维护。</p>
<p>近年来，<a href="http://xcb.freedesktop.org/" rel="noopener noreferrer">XCB项目</a>使情况变得更为有序，它使用Python从描述X客户端协议的<a href="http://cgit.freedesktop.org/xcb/proto/tree/src" rel="noopener noreferrer">XML文件</a>生成C代码。虽然<a href="http://cgit.freedesktop.org/xcb/libxcb/tree/src/c_client.py" rel="noopener noreferrer">用于生成该代码的Python脚本</a>本身并不简单，但它通常优于另一种选择：随着大量扩展的存在而不断更新X核心协议。（XCB还有其他好处，例如更简单的异步性，但这超出了本文的范围。）</p>
<p>XGB沿用了类似的思路；<a href="http://code.google.com/r/jamslam-x-go-binding/source/browse/xgb/go_client.py" rel="noopener noreferrer">使用Python生成Go代码</a>来提供与X协议交互的API。与其姊妹项目XCB不同，它并非线程安全的。具体来说，如果并行发出X请求，最好的情况是请求或回复被搅乱，最坏的情况是X服务器崩溃。当需要将图像发送到X服务器进行屏幕绘制时，并行请求会特别有用；在此期间可以进行其他有用的工作。</p><p><em>由 mimo-v2.5 模型翻译，花费 1084 tokens</em></p>]]></content:encoded>
      <link>https://blog.burntsushi.net/thread-safety-x-go-binding/</link>
      <guid isPermaLink="false">https://blog.burntsushi.net/thread-safety-x-go-binding/</guid>
      <pubDate>Sun, 22 Apr 2012 01:52:00 +0000</pubDate>
    </item>
    <item>
      <title>脑炎</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 作者分享了自己被诊断为抗NMDA受体脑炎的经历，并面向依赖其工作的读者进行说明。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 作者分享了自己被诊断为抗NMDA受体脑炎的经历，并面向依赖其工作的读者进行说明。</div><p>我最近被诊断为<a href="https://en.wikipedia.org/wiki/Anti-NMDA_receptor_encephalitis" rel="noopener noreferrer">抗NMDA受体脑炎</a>。这是一种自身免疫性疾病，患者体内的抗体本应有益，但<a href="https://en.wikipedia.org/wiki/Anti-NMDA_receptor_encephalitis#Pathophysiology" rel="noopener noreferrer">却开始异常运作</a>，导致大脑炎症。这篇短文将简述我的一些经历和预后情况。</p>
<p><strong>目标读者</strong>：所有依赖我的工作来开展自身项目的人士。</p><p><em>由 mimo-v2.5 模型翻译，花费 681 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/encephalitis/</link>
      <guid isPermaLink="false">https://burntsushi.net/encephalitis/</guid>
      <pubDate>Wed, 3 Jun 2026 12:30:00 +0000</pubDate>
    </item>
    <item>
      <title>将正则表达式引擎内部机制作为库提供</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 文章讲述了为改进组合性与优化而重写 Rust 正则表达式库，从而创建出暴露内部机制的独立库 regex-automata 的过程与API介绍。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 文章讲述了为改进组合性与优化而重写 Rust 正则表达式库，从而创建出暴露内部机制的独立库 regex-automata 的过程与API介绍。</div><p>过去几年中，我重写了 <a href="https://github.com/rust-lang/regex/" rel="noopener noreferrer">Rust 的 <code>regex</code>
crate</a>，旨在实现更好的内部组合，并在保持正确性的同时更方便地添加优化。在此重写过程中，我创建了一个新的 crate：<a href="https://github.com/rust-lang/regex/tree/master/regex-automata" rel="noopener noreferrer"><code>regex-automata</code></a>，它将 <code>regex</code> crate 的大部分内部机制作为独立的 API 暴露出来供他人使用。据我所知，这是首个以 <code>regex-automata</code> 这样独立版本化的库的形式，将自身内部机制暴露到如此程度的正则表达式库。</p>
<p>这篇博客文章讨论了导致此次重写的问题、重写如何解决这些问题，并对 <code>regex-automata</code> 的 API 进行了导览。</p>
<p><strong>目标读者</strong>：Rust 程序员以及任何对特定有限自动机正则表达式引擎实现方式感兴趣的人。假定读者具有正则表达式的使用经验。</p><p><em>由 mimo-v2.5 模型翻译，花费 869 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/regex-internals/</link>
      <guid isPermaLink="false">https://burntsushi.net/regex-internals/</guid>
      <pubDate>Wed, 5 Jul 2023 13:06:00 +0000</pubDate>
    </item>
    <item>
      <title>面向 Rust 的字节字符串库</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 介绍面向Rust的字节字符串库bstr及其1.0版本的发布。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 介绍面向Rust的字节字符串库bstr及其1.0版本的发布。</div><p><a href="https://docs.rs/bstr/1.*" rel="noopener noreferrer"><code>bstr</code></a> 是一个面向 Rust 的字节字符串库，其 <a href="https://github.com/BurntSushi/bstr/releases/tag/1.0.0" rel="noopener noreferrer">1.0 版本刚刚发布</a>！它为任意字节序列提供以字符串为导向的操作，但在处理 UTF-8 编码的字节时最为有用。换言之，它提供了一种通过<em>约定</em>来确保内容为 UTF-8 的字符串类型，而 Rust 内置的字符串类型则是<em>保证</em>为 UTF-8 的。</p>
<p>本篇博客将简要介绍其 API，深入探讨创建 <code>bstr</code> 的动机，展示一些使用 <code>bstr</code> 的简短示例程序，并以一些思考作为结尾。</p>
<p><strong>目标读者</strong>：具备一些 UTF-8 背景知识的 Rust 程序员。</p><p><em>由 mimo-v2.5 模型翻译，花费 844 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/bstr/</link>
      <guid isPermaLink="false">https://burntsushi.net/bstr/</guid>
      <pubDate>Wed, 7 Sep 2022 18:00:00 +0000</pubDate>
    </item>
    <item>
      <title>在Rust中使用unwrap()是可以的</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 本文讨论了在Rust测试代码或panic表示存在bug时使用unwrap()是可接受的，并澄清了相关困惑。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文讨论了在Rust测试代码或panic表示存在bug时使用unwrap()是可接受的，并澄清了相关困惑。</div><p>在Rust 1.0发布前一天，我发布了<a href="https://blog.burntsushi.net/rust-error-handling/" rel="noopener noreferrer">一篇介绍错误处理基础的博文</a>。文章中部一个特别重要但篇幅较短的章节名为“<a href="https://blog.burntsushi.net/rust-error-handling/#a-brief-interlude-unwrapping-isnt-evil" rel="noopener noreferrer">解包（unwrapping）并非邪恶</a>”。该章节简要说明：总体而言，如果在测试/示例代码中使用<code>unwrap()</code>，或者当panic表示存在错误时使用它，是完全可以的。</p>
<p>我至今基本仍持这一观点。这一实践在Rust标准库及众多核心生态库中都有应用。（而且这种应用早于我的博文发布。）然而，关于何时可以或不可以使用<code>unwrap()</code>，似乎仍存在广泛的困惑。本文将更详细地讨论这一点，并具体回应我见过的一些立场。</p>
<p>这篇博文在一定程度上是以常见问题解答（FAQ）的形式撰写的，但建议按顺序阅读。每个问题都建立在前一个问题的基础上。</p>
<p><strong>目标受众</strong>：主要是Rust程序员，但我希望提供了足够的背景信息，使本文阐述的原则适用于任何程序员。尽管对于使用不同错误处理机制（如异常）的语言来说，可能难以进行明显映射。</p><p><em>由 mimo-v2.5 模型翻译，花费 1058 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/unwrap/</link>
      <guid isPermaLink="false">https://burntsushi.net/unwrap/</guid>
      <pubDate>Mon, 8 Aug 2022 13:00:00 +0000</pubDate>
    </item>
    <item>
      <title>在 System76 Darter Pro 上安装 Archlinux</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 本文回顾了作者在 System76 Darter Pro 上安装和使用 Archlinux 的体验。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文回顾了作者在 System76 Darter Pro 上安装和使用 Archlinux 的体验。</div><p>这是一篇关于我在 System76 Darter Pro（型号：darp6）上配置 Archlinux 的简短回顾，并附带一些对这款笔记本电脑的总体看法。这是自<a href="https://burntsushi.net/lenovo-thinkpad-t430-archlinux" rel="noopener noreferrer">2012年7月购买 ThinkPad T430</a>以来，我的首次笔记本电脑升级。</p>
<p>目标受众：正在寻找兼容 Linux 笔记本电脑的 Archlinux 用户。</p><p><em>由 mimo-v2.5 模型翻译，花费 556 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/system76-darter-archlinux/</link>
      <guid isPermaLink="false">https://burntsushi.net/system76-darter-archlinux/</guid>
      <pubDate>Mon, 27 Jan 2020 22:55:00 +0000</pubDate>
    </item>
    <item>
      <title>我的自由与开源软件故事</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 这是一篇个人反思文章，作者分享了自己与自由与开源软件的关系，旨在促进社区的理解和共情。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 这是一篇个人反思文章，作者分享了自己与自由与开源软件的关系，旨在促进社区的理解和共情。</div><p>我想打破以往专注于纯技术内容的传统，分享一点我个人与自由与开源软件的关系。虽然每个人都不尽相同，但我希望通过分享我的视角，能够促进理解、共情和信任。</p>
<p>这并非旨在直接回应任何其他维护者的行为，也不应被解读为自由与开源软件领域理想行为的规范。这更多是个人反思，希望能启发他人也反思自己与自由与开源软件的关系。成为优秀的自由与开源软件维护者没有唯一正确的道路，我们都有自己的应对方式。</p>
<p>这绝不是在呼吁寻求帮助，重点是理解。这不是关于改变自由与开源软件经济模式的恳求，不是关于改善我心理健康的头脑风暴，也不是关于招募更多维护者。这是关于分享我的故事，并试图增进自由与开源软件界成员之间的共情。</p>
<p><strong>目标读者</strong>：所有参与自由与开源软件的人。</p><p><em>由 mimo-v2.5 模型翻译，花费 791 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/foss/</link>
      <guid isPermaLink="false">https://burntsushi.net/foss/</guid>
      <pubDate>Sun, 19 Jan 2020 22:15:00 +0000</pubDate>
    </item>
    <item>
      <title>Rust 与 CSV 解析</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 这是一篇面向 Rust 初学者的 CSV 数据读写入门教程，以示例为主讲解基础概念。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 这是一篇面向 Rust 初学者的 CSV 数据读写入门教程，以示例为主讲解基础概念。</div><p>随着 <code>csv 1.0</code> 的发布，现在正是撰写一个关于如何在 Rust 中读写 CSV 数据教程的好时机。本教程面向 Rust 初学者，因此包含大量示例，并花时间讲解基本概念。经验丰富的 Rust 开发者可能会觉得部分内容有用，但快速浏览一遍可能更为合适。</p>
<p>关于 Rust 的介绍，请参阅<a href="https://doc.rust-lang.org/book/second-edition/" rel="noopener noreferrer">官方书籍</a>。如果您尚未编写过任何 Rust 代码，但已经在其他语言中写过代码，那么本教程可能无需您先阅读该书就能理解。</p>
<p>该 CSV 库可在 <a href="https://github.com/BurntSushi/rust-csv" rel="noopener noreferrer">Github 上获取</a>，并提供<a href="https://docs.rs/csv" rel="noopener noreferrer">全面的 API 文档</a>。</p>
<p>最后，本文的某个版本已作为<a href="https://docs.rs/csv/1.0.0/csv/tutorial/index.html" rel="noopener noreferrer">教程</a>收录在 API 文档中，并且更有可能随着时间的推移进行更新。</p>
<p><strong>目标受众</strong>：Rust 初学者。</p><p><em>由 mimo-v2.5 模型翻译，花费 873 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/csv/</link>
      <guid isPermaLink="false">https://burntsushi.net/csv/</guid>
      <pubDate>Tue, 23 May 2017 01:01:00 +0000</pubDate>
    </item>
    <item>
      <title>ripgrep 速度超越 {grep、ag、git grep、ucg、pt、sift}</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 本文介绍并基准测试了用Rust编写的高速跨平台命令行搜索工具ripgrep，论证其在性能与Unicode支持上优于同类工具。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文介绍并基准测试了用Rust编写的高速跨平台命令行搜索工具ripgrep，论证其在性能与Unicode支持上优于同类工具。</div><p>在本文中，我将介绍一个新的命令行搜索工具——<a href="https://github.com/BurntSushi/ripgrep" rel="noopener noreferrer"><code>ripgrep</code></a>，它结合了<a href="https://github.com/ggreer/the_silver_searcher" rel="noopener noreferrer">The Silver Searcher</a>（一个<a href="http://beyondgrep.com/" rel="noopener noreferrer"><code>ack</code></a>克隆）的易用性以及GNU grep的原始性能。<code>ripgrep</code>速度快、跨平台（提供适用于Linux、Mac和Windows的二进制文件），并使用<a href="https://www.rust-lang.org" rel="noopener noreferrer">Rust</a>语言编写。</p>
<p><code>ripgrep</code>可在<a href="https://github.com/BurntSushi/ripgrep" rel="noopener noreferrer">Github</a>上获取。</p>
<p>我们将尝试做一件看似不可能的事：对多种流行的代码搜索工具进行一次公平的基准比较。具体来说，我们将深入研究一系列25个基准测试，以证实以下主张：</p>
<ul>
<li>无论是搜索单个文件<em>还是</em>海量文件目录，在性能和正确性方面，没有其他工具能明显超越<code>ripgrep</code>。</li>
<li><code>ripgrep</code>是唯一一个提供正确的Unicode支持且不会让你为此付出高昂性能代价的工具。</li>
<li>那些同时搜索多个文件的工具，如果使用内存映射，通常<em>更慢</em>，而不是更快。</li>
</ul>
<p>作为过去2.5年在业余时间使用Rust处理文本搜索的工作者，以及<code>ripgrep</code>和<a href="https://github.com/rust-lang-nursery/regex" rel="noopener noreferrer">底层正则表达式引擎</a>的作者，我将借此机会深入剖析每个代码搜索工具的性能。每个基准测试都将受到审视！</p>
<p><strong>目标读者</strong>：熟悉Unicode、编程，并在命令行工作方面有一定经验的人士。</p>
<p><strong>注意</strong>：我从一些人那里听说，<code>rg</code>在他们的数据上并没有我声称的那么快。我很乐意帮忙解释原因，但为此我需要能够复现你的结果。如果你能<a href="https://github.com/BurntSushi/ripgrep/issues" rel="noopener noreferrer">提交一个issue</a>并提供我可以复现的信息，我将很乐意尝试解释。</p><p><em>由 mimo-v2.5 模型翻译，花费 1525 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/ripgrep/</link>
      <guid isPermaLink="false">https://burntsushi.net/ripgrep/</guid>
      <pubDate>Fri, 23 Sep 2016 11:05:00 +0000</pubDate>
    </item>
    <item>
      <title>使用自动机和Rust索引16亿个键</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 本文介绍如何使用有限状态机和Rust来高效索引和搜索大规模字符串数据集，例如超过16亿个URL。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文介绍如何使用有限状态机和Rust来高效索引和搜索大规模字符串数据集，例如超过16亿个URL。</div><p>事实证明，有限状态机除了用于表达计算外还有其他用途。有限状态机也可用于紧凑地表示可快速搜索的字符串有序集合或映射。</p>
<p>在本文中，我将向你介绍作为<em>数据结构</em>的有限状态机，用于表示有序集合和映射。这包括介绍一个用Rust编写的实现，即<a href="https://github.com/BurntSushi/fst" rel="noopener noreferrer"><code>fst</code> crate</a>。它附带<a href="https://burntsushi.net/rustdoc/fst/" rel="noopener noreferrer">完整的API文档</a>。我还会向你展示如何使用一个简单的命令行工具来构建它们。最后，我将讨论几个实验，最终实现对<a href="http://blog.commoncrawl.org/2015/08/july-2015-crawl-archive-available/" rel="noopener noreferrer">2015年7月Common Crawl归档</a>中超过16亿个URL（134 GB）的索引。</p>
<p>本文介绍的技术也是<a href="http://blog.mikemccandless.com/2010/12/using-finite-state-transducers-in.html" rel="noopener noreferrer">Lucene表示其部分倒排索引</a>的方式。</p>
<p>过程中，我们将讨论内存映射、自动机与正则表达式的交集运算、基于Levenshtein距离的模糊搜索以及流式集合操作。</p>
<p><strong>目标读者</strong>：熟悉编程和基本数据结构。无需自动机理论或Rust经验。</p><p><em>由 mimo-v2.5 模型翻译，花费 1083 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/transducers/</link>
      <guid isPermaLink="false">https://burntsushi.net/transducers/</guid>
      <pubDate>Thu, 12 Nov 2015 02:45:00 +0000</pubDate>
    </item>
    <item>
      <title>Rust 中的错误处理</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 本文全面介绍了 Rust 中的错误处理方法，包括常见问题和使用标准库的技巧。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文全面介绍了 Rust 中的错误处理方法，包括常见问题和使用标准库的技巧。</div><p>和大多数编程语言一样，Rust 鼓励程序员以特定的方式处理错误。一般来说，错误处理分为两大类：异常和返回值。Rust 选择了返回值。</p>
<p>在这篇文章中，我打算全面介绍如何在 Rust 中处理错误。不仅如此，我将尝试逐步引入错误处理，以便你能获得一个扎实的实践知识，了解所有部分如何协同工作。</p>
<p>如果处理不当，Rust 中的错误处理可能会冗长且令人烦恼。本文将探讨这些障碍，并展示如何使用标准库使错误处理变得简洁和符合人体工程学。</p>
<p><strong>目标读者</strong>：那些刚接触 Rust 且不了解其错误处理惯用法的人。对 Rust 有一些熟悉会有帮助。（本文大量使用了一些标准 trait，并非常轻量地使用了闭包和宏。）</p>
<p><strong>更新（2018/04/14）</strong>：示例已转换为使用 <code>?</code>，并添加了一些文本以提供更改的历史背景。</p>
<p><strong>更新（2020/01/03）</strong>：移除了使用 <a href="https://crates.io/crates/failure" rel="noopener noreferrer"><code>failure</code></a> 的推荐，并替换为推荐使用 <code>Box&lt;Error + Send + Sync&gt;</code> 或 <a href="https://crates.io/crates/anyhow" rel="noopener noreferrer"><code>anyhow</code></a>。</p><p><em>由 mimo-v2.5 模型翻译，花费 2364 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/rust-error-handling/</link>
      <guid isPermaLink="false">https://burntsushi.net/rust-error-handling/</guid>
      <pubDate>Thu, 14 May 2015 14:47:26 +0000</pubDate>
    </item>
    <item>
      <title>Rust 的语法扩展与正则表达式</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 本文介绍了如何通过 Rust 语法扩展，在编译时将正则表达式编译为原生代码，并确保其与运行时编译版本拥有相同的 API。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文介绍了如何通过 Rust 语法扩展，在编译时将正则表达式编译为原生代码，并确保其与运行时编译版本拥有相同的 API。</div><p><strong>警告：</strong> 2018-04-12：本文的代码片段已不再可用。这也没关系，因为它们都依赖于一个多年前就不存在的不稳定内部编译器接口。</p>
<p>几周前，我开始着手为 <a href="http://www.rust-lang.org/" rel="noopener noreferrer">Rust</a> 发行版添加正则表达式功能，其实现和功能集主要参考了 <a href="http://swtch.com/~rsc/regexp/" rel="noopener noreferrer">Russ Cox 的 RE2</a>。它最近已被加入到 <a href="http://static.rust-lang.org/doc/master/regex/index.html" rel="noopener noreferrer">Rust 发行版</a>中。</p>
<p>这个正则表达式 crate 包含一个语法扩展，能在 Rust 程序编译时将正则表达式编译为原生 Rust 代码。这可以被视为“提前编译”，或类似于<a href="http://en.wikipedia.org/wiki/Compile_time_function_execution" rel="noopener noreferrer">编译时函数执行</a>。这些特殊原生编译的正则表达式拥有与在运行时编译的正则表达式<em>完全相同</em>的 API。</p>
<p>在本文中，我将概述我的实现策略——包括如何编写 Rust 语法扩展的代码示例——并描述我如何能够实现编译时编译的正则表达式与运行时编译的正则表达式之间完全相同的 API。</p><p><em>由 mimo-v2.5 模型翻译，花费 1035 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/rust-regex-syntax-extensions/</link>
      <guid isPermaLink="false">https://burntsushi.net/rust-regex-syntax-extensions/</guid>
      <pubDate>Mon, 21 Apr 2014 23:51:00 +0000</pubDate>
    </item>
    <item>
      <title>在Go中编写类型参数化函数</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 本文介绍如何使用Go的`ty`包编写类型参数化函数，在保持运行时类型安全的同时简化调用方式。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文介绍如何使用Go的`ty`包编写类型参数化函数，在保持运行时类型安全的同时简化调用方式。</div><p>Go在编译时实现类型安全多态的唯一机制是结构化子类型，本文不会改变这一点。相反，我将介绍一个名为<code>ty</code>的工具包，它提供在Go中编写类型参数化函数的方案，既能保持<strong>运行时</strong>类型安全，又方便调用方使用。</p><p><em>由 mimo-v2.5 模型翻译，花费 513 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/type-parametric-functions-golang/</link>
      <guid isPermaLink="false">https://burntsushi.net/type-parametric-functions-golang/</guid>
      <pubDate>Sat, 6 Apr 2013 17:54:00 +0000</pubDate>
    </item>
    <item>
      <title>介绍NFLGame：通过程序化方式获取实时NFL比赛统计数据</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 一位程序员为解决NFL数据获取难题，启动了新的开源程序库项目。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 一位程序员为解决NFL数据获取难题，启动了新的开源程序库项目。</div><p>作为一名程序员和梦幻橄榄球迷，我为我们获取机器可读数据所需付出的努力感到尴尬。开源软件的匮乏使社区充斥着劣质工具，更重要的是，这阻碍了利用便捷统计数据本可实现的许多真正有趣的功能。许多工具要么过时，要么无法运行；即便能用，它们也是闭源的，且通常需要付费。</p>
<p>昨天，我开始着手开发一个新的程序库，希望能改善这种可悲的现状。</p><p><em>由 mimo-v2.5 模型翻译，花费 618 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/nfl-live-statistics-with-python/</link>
      <guid isPermaLink="false">https://burntsushi.net/nfl-live-statistics-with-python/</guid>
      <pubDate>Thu, 30 Aug 2012 05:45:00 +0000</pubDate>
    </item>
    <item>
      <title>在联想ThinkPad T430上运行Arch Linux</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] 本文记录了在联想ThinkPad T430上成功部署Arch Linux系统的个人经验与配置笔记。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> 本文记录了在联想ThinkPad T430上成功部署Arch Linux系统的个人经验与配置笔记。</div><p>总之，Arch Linux运行得相当出色。以下是在联想ThinkPad T430上安装、配置、调优和使用Arch Linux时，我整理的大致笔记。</p><p><em>由 mimo-v2.5 模型翻译，花费 445 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/lenovo-thinkpad-t430-archlinux/</link>
      <guid isPermaLink="false">https://burntsushi.net/lenovo-thinkpad-t430-archlinux/</guid>
      <pubDate>Sun, 1 Jul 2012 05:39:00 +0000</pubDate>
    </item>
    <item>
      <title>将Go程序守护进程化（BSD风格rc.d示例）</title>
      <dc:creator>author</dc:creator>
      <description>[AI 摘要] Go程序的多线程特性使得fork守护进程化困难，文章建议用nohup来解决这个问题。</description>
      <content:encoded><![CDATA[<div style="background:#f0f4f8;border-left:3px solid #3b82f6;padding:12px 16px;border-radius:6px;margin:12px 0;font-size:14px;color:#555"><strong>[AI 摘要]</strong> Go程序的多线程特性使得fork守护进程化困难，文章建议用nohup来解决这个问题。</div><p>Go语言本质上是多线程的。这使得通过fork方式将Go程序守护进程化的传统方法有点困难。</p>
<p>为了解决这个问题，你可以尝试一种简单的方法，即将Go程序放在后台运行，并让它<a href="http://en.wikipedia.org/wiki/Nohup" rel="noopener noreferrer">忽略HUP信号</a>：</p><p><em>由 mimo-v2.5 模型翻译，花费 572 tokens</em></p>]]></content:encoded>
      <link>https://burntsushi.net/golang-daemonize-bsd/</link>
      <guid isPermaLink="false">https://burntsushi.net/golang-daemonize-bsd/</guid>
      <pubDate>Sat, 28 Apr 2012 02:12:00 +0000</pubDate>
    </item>
  </channel>
</rss>
