Add proc macro for converting async traits to return StackFutures

Open
#5 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
backend

Research direction

Start by reviewing the existing StackFuture API and the async_trait crate behavior referenced in the issue. Define how the proc macro should expand both trait declarations and impls, including required lifetime annotations; done means both forms produce working StackFuture-returning methods with the requested capacity.

Written by the indexing model from the issue text.

Description

enhancement

The idea here is to make a macro similar to the #[async_trait] one from the async trait crate. Using it would look something like this:

#[stackfuture::async_trait(4096)]
trait Foo {
    async fn bar(&self) -> i32;
}

The macro would then expand to something like (along with whatever lifetime annotations are needed:

trait Foo {
    fn bar(&self) -> StackFuture<i32, { 4096 }>`;
}

We'd do a similar thing for impls as well.

Dominant language
Rust
Stars
314
Forks
17
Avg merge
11h 50m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/stackfuture

All issues in microsoft/stackfuture

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.