git404hub

what is async-trait fr?

dtolnay/async-trait — explained in plain English

Analysis updated 2026-07-17 · repo last pushed 2026-03-24

2,157RustAudience · developerComplexity · 2/5MaintainedSetup · easy

tl;dr

async-trait is a Rust macro that lets you write async methods inside traits, something Rust doesn't support natively, so trait objects can hold different types that each run async code.

vibe map

mindmap
  root((repo))
    What it does
      Async trait methods
      Macro based
      Dynamic dispatch
    Tech stack
      Rust
      Procedural macros
    Use cases
      Plugin systems
      Shared interfaces
      Trait objects
    Audience
      Rust developers
    Caveats
      Send bounds
      Explicit lifetimes

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Add async methods to a Rust trait by marking it with #[async_trait], without hand-writing future plumbing.

VIBE 2

Build a plugin-style system where different types implement a shared trait with an async run() method.

VIBE 3

Use dynamic dispatch with async trait methods, like storing different ad types or handlers behind one interface.

VIBE 4

Opt out of Send bounds with #[async_trait(?Send)] when your async trait methods don't need to cross threads.

what's the stack?

Rust

how it stacks up fr

dtolnay/async-traitb-nnett/gooseorhun/ratty
Stars2,1572,1762,082
LanguageRustRustRust
Last pushed2026-03-24
MaintenanceMaintained
Setup difficultyeasyhardmoderate
Complexity2/54/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · easy time til it works · 5min

prompts (copy fr)

prompt 1
Show me how to add the #[async_trait] macro to a Rust trait so I can define an async method inside it.
prompt 2
I have a Rust trait with different implementations that each need an async run() method. Show me how async-trait makes that work with dynamic dispatch.
prompt 3
Explain what #[async_trait(?Send)] does and when I should use it instead of the default macro behavior.
prompt 4
Write a Rust example using async-trait where a trait has a default implementation for one async method and a required implementation for another.
prompt 5
How does the async-trait macro convert my async method into something compatible with Rust's trait objects under the hood?

Frequently asked questions

what is async-trait fr?

async-trait is a Rust macro that lets you write async methods inside traits, something Rust doesn't support natively, so trait objects can hold different types that each run async code.

What language is async-trait written in?

Mainly Rust. The stack also includes Rust.

Is async-trait actively maintained?

Maintained — commit in last 6 months (last push 2026-03-24).

How hard is async-trait to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is async-trait for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.