maybe-async-rs icon indicating copy to clipboard operation
maybe-async-rs copied to clipboard

`maybe_async` on structs

Open Niederb opened this issue 1 year ago • 1 comments

According to the readme I can apply the macro to struct definitions. However if I do this on an impl block for a struct (without trait) I get an error due to this check: https://github.com/fMeow/maybe-async-rs/blob/b8be6e43d3f64bae52063d5b46f4e627303bc733/src/parse.rs#L26 If I apply it directly on the struct I get this error: https://github.com/fMeow/maybe-async-rs/blob/b8be6e43d3f64bae52063d5b46f4e627303bc733/src/parse.rs#L43 I was hoping to apply the macro on a struct or its impl in order to affect all its methods. Is there something wrong with my line of thinking? If not I could try to come up with an PR for this.

Niederb avatar Apr 13 '23 08:04 Niederb

I think it fine. And I am open to an PR for this too.

But in my opinion, a better solution might be providing both async and sync methods for a struct implementation. I tried a little bit to generate both async and sync block but that could mess up compiler message when compiler erorr occurs in inner code block.

fMeow avatar Apr 14 '23 07:04 fMeow