<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Trait on Mi&amp;Bee Blog</title><link>https://blog.mickeyzzc.tech/en/tags/trait/</link><description>Recent content in Trait on Mi&amp;Bee Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>蓝宝石的傻话</managingEditor><lastBuildDate>Thu, 14 May 2026 10:00:00 +0800</lastBuildDate><atom:link href="https://blog.mickeyzzc.tech/en/tags/trait/rss.xml" rel="self" type="application/rss+xml"/><item><title>Traits and Generics: Rust's Type Abstraction System</title><link>https://blog.mickeyzzc.tech/en/posts/programming/rust-traits-generics/</link><pubDate>Thu, 14 May 2026 10:00:00 +0800</pubDate><guid>https://blog.mickeyzzc.tech/en/posts/programming/rust-traits-generics/</guid><description>&lt;p&gt;In the previous articles, we explored Rust&amp;rsquo;s ownership system, error handling, and module management. Now we dive into the two core components of Rust&amp;rsquo;s type system—&lt;strong&gt;traits&lt;/strong&gt; and &lt;strong&gt;generics&lt;/strong&gt;. These form the foundation of Rust&amp;rsquo;s abstraction mechanisms: traits provide compile-time behavioral constraints, while generics bring type-safe parametric programming.&lt;/p&gt;
&lt;p&gt;Rust&amp;rsquo;s trait system has similarities to Go&amp;rsquo;s interfaces, but the essence is different. Go&amp;rsquo;s interfaces use implicit implementation with duck typing, while Rust&amp;rsquo;s traits are explicitly declared contracts. More importantly, Rust&amp;rsquo;s traits combined with generics enable complete type checking and monomorphization at compile time, achieving zero-cost abstraction.&lt;/p&gt;</description></item></channel></rss>