<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Rust on pg999w&#39;s blog</title>
    <link>https://vpssg1.zyk999.top/tags/rust/</link>
    <description>Recent content in Rust on pg999w&#39;s blog</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Mon, 16 Sep 2024 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://vpssg1.zyk999.top/tags/rust/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>可执行文件与动态库共享全局变量</title>
      <link>https://vpssg1.zyk999.top/post/rust-dylib-export/</link>
      <pubDate>Mon, 16 Sep 2024 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/rust-dylib-export/</guid>
      <description>&lt;p&gt;有时候我们会希望通过 dlopen 来加载一个动态链接库，并且在主程序中和库中访问同一个全局变量。下面用 Rust 来实现一个 &lt;a href=&#34;https://en.wikipedia.org/wiki/Minimal_reproducible_example&#34;&gt;MWE&lt;/a&gt;。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rust 和 C&#43;&#43; 的对象生命管理</title>
      <link>https://vpssg1.zyk999.top/post/rust-cpp-object-management/</link>
      <pubDate>Tue, 14 Nov 2023 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/rust-cpp-object-management/</guid>
      <description>&lt;p&gt;Rust 和 C++ 的对象都是值语义，都采用了 RAII 惯用法。所以他们需要处理类似的对象生命周期问题：需要专门的代码来处理对象的初始化，复制和析构。下面进行一个比较，我们能够看到两种语言之间内在的对称性。&lt;/p&gt;</description>
    </item>
    <item>
      <title>用 Nix 管理交叉编译 Rust 项目的环境</title>
      <link>https://vpssg1.zyk999.top/post/nix-smartcross/</link>
      <pubDate>Sun, 11 Dec 2022 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/nix-smartcross/</guid>
      <description>&lt;p&gt;SmartCross 项目的介绍见&lt;a href=&#34;https://blog.t123yh.xyz:2/index.php/archives/1077&#34;&gt;这里&lt;/a&gt;。其中的控制器组件用 Rust 写成，需要编译到 aarch64 平台。我尝试写了一个 &lt;a href=&#34;https://nixos.org/&#34;&gt;Nix&lt;/a&gt; 表达式来管理该项目的环境。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Too many channels in Rust but only one in Go</title>
      <link>https://vpssg1.zyk999.top/post/too-many-channels/</link>
      <pubDate>Thu, 24 Mar 2022 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/too-many-channels/</guid>
      <description>&lt;p&gt;Channel 是异步编程 CSP 模型&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;和 Actor 模型的重要组成部分，是一种用于消息同步的数据结构。Go 语言中的 &lt;code&gt;chan&lt;/code&gt; 类型即是一种 channel 的实现。在使用 Rust 进行异步编程的时候也需要使用 channel。然而 Rust 中的 channel 似乎太多了。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rust 编译到 musl target 的踩坑记录</title>
      <link>https://vpssg1.zyk999.top/post/rust-musl-target/</link>
      <pubDate>Sun, 30 May 2021 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/rust-musl-target/</guid>
      <description>&lt;p&gt;Rust 在 x86_64-unknown-linux-gnu 目标下默认会动态链接到系统 C 运行时&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;，而不同发行版之间的 libc 可能会有兼容性问题。如果想要把一次编译好的可执行文件放到不同的 Linux 发行版上面去跑，最好采用 x86_64-unknown-linux-musl 目标进行静态编译。&lt;/p&gt;</description>
    </item>
    <item>
      <title>从 C&#43;&#43; 的错误处理说起</title>
      <link>https://vpssg1.zyk999.top/post/c&#43;&#43;-p0709/</link>
      <pubDate>Thu, 16 Apr 2020 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/c&#43;&#43;-p0709/</guid>
      <description>&lt;p&gt;&lt;strong&gt;错误处理&lt;/strong&gt;是一个非常重要的软件工程问题。对软件中出现的非致命错误的不当处理，是几乎所有的灾难性系统故障的诱因。&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; 编程语言往往需要提供一些用于错误处理的语言设施，这些设施反过来会影响项目中错误处理的方式。不同的语言错误处理方式不同。例如 Java 采用基于 try-throw-catch 语法的异常机制，而 Go 语言则选择手动检测函数返回的 &lt;code&gt;error&lt;/code&gt; 对象。一个令人惊讶的事实是，C++ 到现在还没有一个被广泛接受的错误处理方式。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rust 的指针别名优化</title>
      <link>https://vpssg1.zyk999.top/post/csarpp-opt/</link>
      <pubDate>Sat, 19 Jan 2019 00:00:00 +0000</pubDate>
      <guid>https://vpssg1.zyk999.top/post/csarpp-opt/</guid>
      <description>&lt;p&gt;本文研究了基于 Rust 具有的所有权语义的一些优化。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
