# dtolnay/async-trait

Type erasure for async trait methods

Repository: https://github.com/dtolnay/async-trait
Canonical: https://ross.abutalabs.com/products/async-trait
Language: Rust
License: Apache-2.0
License Family: permissive
Last push: 2026-08-25T03:37:21+00:00

## Health v2 (maintenance only)
Score: 98/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 96, longevity 100
- inputs: {"age_days": 2599, "days_push": 8, "days_rel": 25, "gap_med": 25, "n_releases_24m": 10}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2186, forks 101 (observed 2026-08-28T04:06:23.549874+00:00)

## What it is
A Rust attribute macro crate that makes async functions in traits work with dyn Trait (dynamic dispatch) via type erasure. It bridges the gap left by Rust 1.75's native async fn in traits, which does not support dyn compatibility.

## Use cases
- use async fn in traits with Box<dyn Trait>
- make async trait methods dyn compatible
- store heterogeneous async trait objects in a Vec
- avoid 'trait is not dyn compatible' errors for async methods
- write async trait impls that work across Rust versions

## When to choose
- you need dyn Trait with async trait methods
- you must support Rust versions older than 1.75
- you want boxed async trait objects in collections

## When to avoid
- you only need static dispatch of async trait methods (use native async fn in traits)
- you can use the built-in dyn-compatible alternatives in modern Rust

## Facets
- artifact type: library
- maturity: stable
- function: type-system, concurrency, developer-tools
- domain: programming-languages, developer-tools
- platform: rust, cross-platform
- tags: async, proc-macro, dyn-trait, attribute-macro, rust, algorithms

## Member repositories
- dtolnay/async-trait (main) score 98

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:23.549874+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:47:54.267493+00:00, confidence not recorded.
  - readme: https://github.com/dtolnay/async-trait (fetched 2026-08-28T04:06:23.549874+00:00, sha c1dda26b0039)
  - registry_crates: https://crates.io/api/v1/crates/async-trait (fetched 2026-08-29T10:28:05.740395+00:00, sha 2b8a8139e15e)
- Data as of 2026-08-30T08:39:29.467469+00:00.
