Right now we only accept Result<T, substreams::errors::Error> when using proc-macro #[substreams::handler::map] but a lot of use cases would make the experience easier if we accepted the form Result<Option<T>, substreams::errors::Error>, plain Option<T> and maybe even just T.
The goal of this task is to update the Rust proc macro code in substreams-rs to properly support all those cases.
Proc macro don't have access to type information as it work as the lexing level having access to "token". So we will need some "hard-coded" "String" check to determine the right code to generate.
[x] Allow new forms mentioned above
[ ] Ensure unit tests show all this
[x] Ensure Rust doc is properly updated with new usage
[x] Substreams documentation is updated to list possible usage of the macro
[x] Maybe we should add a note on substreams CHANGELOG so this change is more discoverable
Right now we only accept
Result<T, substreams::errors::Error>
when using proc-macro#[substreams::handler::map]
but a lot of use cases would make the experience easier if we accepted the formResult<Option<T>, substreams::errors::Error>
, plainOption<T>
and maybe even justT
.The goal of this task is to update the Rust proc macro code in
substreams-rs
to properly support all those cases.Proc macro don't have access to type information as it work as the lexing level having access to "token". So we will need some "hard-coded" "String" check to determine the right code to generate.
substreams
CHANGELOG so this change is more discoverable