Get the latest tech news

Alternative Blanket Implementations for a Single Rust Trait


A blog about software development.

One such rule is that you can't have multiple blanket implementations of the same trait that could potentially apply to the same type. The key piece: the associated type Target tells Adapter whether to delegate to Unified<Self> or Partitioned<Self>. This pattern - using marker types + associated types- gives you the flexibility of alternative blanket implementations while staying within Rust's coherence rules.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of single rust trait

single rust trait