diff --git a/README.md b/README.md index 301ce3f..97dbac9 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ can't be that badly broken. ## Explanation Async fns get transformed into methods that return `Pin>` and delegate to a private async freestanding function. +'async_trait>>` and delegate to an async block. For example the `impl Advertisement for AutoplayingVideo` above would be expanded as: @@ -131,11 +131,9 @@ impl Advertisement for AutoplayingVideo { where Self: Sync + 'async_trait, { - async fn run(_self: &AutoplayingVideo) { + Box::pin(async move { /* the original method body */ - } - - Box::pin(run(self)) + }) } } ``` diff --git a/src/lib.rs b/src/lib.rs index e2365c3..d7223ca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -133,7 +133,7 @@ //! # Explanation //! //! Async fns get transformed into methods that return `Pin>` and delegate to a private async freestanding function. +//! Send + 'async_trait>>` and delegate to an async block. //! //! For example the `impl Advertisement for AutoplayingVideo` above would be //! expanded as: @@ -147,11 +147,9 @@ //! where //! Self: Sync + 'async_trait, //! { -//! async fn run(_self: &AutoplayingVideo) { +//! Box::pin(async move { //! /* the original method body */ -//! } -//! -//! Box::pin(run(self)) +//! }) //! } //! } //! # };