<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Routing Design on Chrislearn&#39;s Blog</title>
    <link>https://www.chrislearn.im/tags/routing-design/</link>
    <description>Recent content in Routing Design on Chrislearn&#39;s Blog</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Tue, 07 Apr 2026 22:49:29 +0800</lastBuildDate>
    <atom:link href="https://www.chrislearn.im/tags/routing-design/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Why Salvo Doesn&#39;t Embrace Macro-Style Routing</title>
      <link>https://www.chrislearn.im/2026/04/why-salvo-doesnt-embrace-macro-style-routing/</link>
      <pubDate>Tue, 07 Apr 2026 00:00:00 +0000</pubDate>
      <guid>https://www.chrislearn.im/2026/04/why-salvo-doesnt-embrace-macro-style-routing/</guid>
      <description>&lt;p&gt;Frameworks like Actix-web and Rocket support writing routes like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-rust&#34; data-lang=&#34;rust&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#[get(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;/users/{id}&amp;#34;&lt;/span&gt;&lt;span class=&#34;cp&#34;&gt;)]&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;async&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;fn&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;show&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;id&lt;/span&gt;: &lt;span class=&#34;nc&#34;&gt;web&lt;/span&gt;::&lt;span class=&#34;n&#34;&gt;Path&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;i32&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;-&amp;gt; &lt;span class=&#34;nc&#34;&gt;impl&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Responder&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;/* ... */&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Many people think this is &amp;ldquo;elegant&amp;rdquo; — an attribute macro sits right above the function, and the path, method, and parameters are all visible at a glance, much like Spring MVC&amp;rsquo;s &lt;code&gt;@GetMapping&lt;/code&gt; or FastAPI&amp;rsquo;s &lt;code&gt;@app.get&lt;/code&gt;. Every so often someone files a Salvo issue asking: can we have a &lt;code&gt;#[get]&lt;/code&gt; too?&lt;/p&gt;&#xA;&lt;p&gt;Salvo deliberately doesn&amp;rsquo;t. This article tries to seriously explain the reasoning behind that decision.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
