<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" 
  xmlns:content="http://purl.org/rss/1.0/modules/content/" 
  xmlns:dc="http://purl.org/dc/elements/1.1/" 
  xmlns:atom="http://www.w3.org/2005/Atom" 
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" 
  xmlns:media="http://search.yahoo.com/mrss/">
  <channel>
    <title>Rust on Eval-EXEC</title>
    <link>https://evex.one/series/rust/</link>
    <description>Recent content in Rust on Eval-EXEC</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>execvy@gmail.com (EXEC)</managingEditor>
    <webMaster>execvy@gmail.com (EXEC)</webMaster>
    <copyright>©2026</copyright>
    <lastBuildDate>Fri, 10 Feb 2023 18:27:58 +0800</lastBuildDate>
    
        <atom:link href="https://evex.one/series/rust/index.xml" rel="self" type="application/rss+xml" />
    

      
      <item>
        <title>Cargo Test 的测试隔离性；使用 nextest-rs/nextest 来运行 Rust 的单元测试</title>
        <link>https://evex.one/posts/rust/nextest/</link>
        <pubDate>Fri, 10 Feb 2023 18:27:58 +0800</pubDate>
        <author>execvy@gmail.com (EXEC)</author>
        <atom:modified>Fri, 10 Feb 2023 18:27:58 +0800</atom:modified>
        <guid>https://evex.one/posts/rust/nextest/</guid>
        <description>&lt;h2 id=&#34;随便写一个测试-mod包含多个单元测试&#34;&gt;随便写一个测试 mod，包含多个单元测试：&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-rust#[cfg(test)]&#34; data-lang=&#34;rust#[cfg(test)]&#34;&gt;mod tests {
    use std::time::Duration;

    fn print_my_pid_and_tid() {
        let pid = std::process::id();
        let tid = nix::unistd::gettid();

        println!(&amp;#34;my pid is {}, tid is {}&amp;#34;, pid, tid);
    }

    fn hard_job() {
        std::thread::sleep(Duration::from_secs(2));
    }

    macro_rules! generate_test_functions {
        ($name:ident) =&amp;gt; {
            #[test]
            fn $name() {
                hard_job();
                print_my_pid_and_tid();
            }
        };
    }

    generate_test_functions!(test_0);
    generate_test_functions!(test_1);
    generate_test_functions!(test_2);
    generate_test_functions!(test_3);
    generate_test_functions!(test_4);
    generate_test_functions!(test_5);
    generate_test_functions!(test_6);
    generate_test_functions!(test_7);
    generate_test_functions!(test_8);
    generate_test_functions!(test_9);
    generate_test_functions!(test_10);
    generate_test_functions!(test_11);
    generate_test_functions!(test_12);
    generate_test_functions!(test_13);
    generate_test_functions!(test_14);
    generate_test_functions!(test_15);
    generate_test_functions!(test_16);
    generate_test_functions!(test_17);
    generate_test_functions!(test_18);
    generate_test_functions!(test_19);
}
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;运行整个测试-mod&#34;&gt;运行整个测试 mod：&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;cargo &lt;span class=&#34;nb&#34;&gt;test&lt;/span&gt; -- --nocapture
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;执行结果：&lt;/p&gt;</description>
        
        <dc:creator>EXEC</dc:creator>
        <media:content url="https://evex.one/images/rust/Rust_programming_language_black_logo.svg" medium="image"><media:title type="html">featured image</media:title></media:content>
        
        
        
          
            
              <category>rust</category>
            
          
        
        
          
            
              <category>rust</category>
            
          
        
        
          
            
              <category>rust</category>
            
          
        
      </item>
      
      <item>
        <title>康威的生命游戏（Rust &#43; WebAssembly）</title>
        <link>https://evex.one/posts/fun/conways_game_of_life/</link>
        <pubDate>Mon, 31 Jan 2022 10:47:23 +0800</pubDate>
        <author>execvy@gmail.com (EXEC)</author>
        <atom:modified>Mon, 31 Jan 2022 10:47:23 +0800</atom:modified>
        <guid>https://evex.one/posts/fun/conways_game_of_life/</guid>
        <description>&lt;p&gt;很早之前就知道有一个有趣的东西叫 conway&amp;rsquo;s game of life (康威的人生游戏)，前段时间我用 &lt;code&gt;Rust&lt;/code&gt; 实现了一遍，并且尝试将原作者提出的 &lt;code&gt;2d&lt;/code&gt;版本改成&lt;code&gt;3d&lt;/code&gt;版；还尝试了 &lt;code&gt;Rust WebAssembly&lt;/code&gt;，在网页上欣赏生命游戏。&lt;/p&gt;</description>
        
        <dc:creator>EXEC</dc:creator>
        <media:content url="https://evex.one//images/fun/gameoflife.png" medium="image"><media:title type="html">featured image</media:title></media:content>
        
        
        
          
            
              <category>rust</category>
            
          
        
        
          
            
              <category>rust</category>
            
          
        
        
          
            
              <category>rust</category>
            
          
        
      </item>
      

    
  </channel>
</rss>
