Skip to content

Proc macros to reduce boiler plate #77

@NickLarsenNZ

Description

@NickLarsenNZ

Dapr seems quite easy to get going in other languages that provide annotations/attributes.
I think the same should be done for the Rust SDK.

For example:

[Topic("pubsub", "orders")]
[HttpPost("/checkout")]
public async Task<ActionResult<Order>>Checkout(Order order, [FromServices] DaprClient daprClient)
{
    // Logic
    return order;
}

Could be expressed as:

#[topic(pub_sub_name = "pubsub", topic = "orders")]
#[post("/checkout")]
async fn hello(order: Order) -> String {
    format!("Order id: {}", order.id)
}

Am I right in thinking that the difficulty comes in the variety of HTTP server crates? Or is that quite decoupled from decorating the handler?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2enhancementNew feature or requestpinneddapr-bot exemption

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions