{"id":57102,"library":"async-trait","title":"async-trait","description":"Type erasure for async trait methods","status":"active","version":"0.1.89","language":"rust","source_language":null,"source_url":"https://github.com/dtolnay/async-trait","tags":["async","trait","type-erasure","macro"],"install":[{"cmd":"# Cargo.toml\n[dependencies]\nasync-trait = \"0.1.89\"","lang":"toml","label":"Cargo.toml"},{"cmd":"cargo add async-trait","lang":"bash","label":"cargo add"}],"dependencies":[],"imports":[{"symbol":"async_trait","correct":"use async_trait::async_trait;"}],"quickstart":{"code":"use async_trait::async_trait;\n\n#[async_trait]\npub trait MyTrait {\n    async fn do_something(&self);\n}\n\nstruct MyStruct;\n\n#[async_trait]\nimpl MyTrait for MyStruct {\n    async fn do_something(&self) {\n        println!(\"Done!\");\n    }\n}\n\n#[tokio::main]\nasync fn main() {\n    let s = MyStruct;\n    s.do_something().await;\n}","lang":"rust","description":"Defines an async trait and implements it."},"warnings":[{"fix":"Add tokio as a dependency and use #[tokio::main] or another runtime.","message":"Requires an async runtime (e.g., tokio) to execute the async methods.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'async':2,7,10 'async-trait':1 'erasur':5,14 'macro':15 'method':9 'trait':3,8,11 'type':4,13 'type-erasur':12","created_at":"2026-06-16T15:28:25.941314+00:00","updated_at":"2026-06-16T15:28:25.941314+00:00","problems":[],"ecosystem":"crates","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/dtolnay/async-trait","github":"https://github.com/dtolnay/async-trait","docs":"https://docs.rs/async-trait/","changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["async","utility"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-16","next_check":"2026-12-13","install_tag":null}}