Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make #[transaction] to work on functions not returning Result<T, E> #7

Open
byronwasti opened this issue Apr 17, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@byronwasti
Copy link
Collaborator

Currently, #[transaction] can only be used on async functions which return a Result<T, E>. This let's Balter keep track of the error-rate.

#[transaction]
async fn foo() -> Result<(), Error> {
}

/// Error
#[transaction]
async fn bar() -> MyType {
}

However, certain transactions it might not make any sense to return a Result, and this becomes an unnecessary type restriction. Unfortunately I don't think this is trivial to support. If we have a #[transaction] be anything which returns impl TransactionOutput, then I think the options are limited:

  1. Users need to implement this on their types, which is annoying
  2. Opt-in to the specialization unstable feature, which I'd like to avoid (in order to special-case just Result)
  3. Expand the #[transaction] macro to do more code-gen to make this viable

From what I understand of the issue, (3) is the most viable.

@byronwasti byronwasti added the enhancement New feature or request label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant