balter
balter copied to clipboard
Make `#[transaction]` to work on functions not returning `Result<T, E>`
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:
- Users need to implement this on their types, which is annoying
- Opt-in to the specialization unstable feature, which I'd like to avoid (in order to special-case just
Result
) - 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.