Keeping traits dyn-compatible while preserving zero-cost abstraction where possible
scp-iota.github.io·2d·
Discuss: r/rust
📏Linear Types
Preview
Report Post

Published on 20 Jan 2026

This post is from the Software category.

If you’re fairly familiar with Rust, you’ve probably seen and used dyn trait objects: references to values that implement specific traits without knowledge of the concrete underlying type. For example, Box<dyn std::error::Error> is a frequent go-to error type when you don’t want to mess with breaking down every possible error type that could be returned by a function. Trait objects are intended for more than convenience, though; they give you the flexibility to mix and swap out underlying implementations of a trait at runtime.

For example, a codebase that accesses a database through a layer of abstraction will likely have a trait for the overall data conn…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help