Is there a way to return a function? #1646
Unanswered
jjangga0214
asked this question in
Q&A
Replies: 1 comment 1 reply
-
See this for example: https://github.com/napi-rs/napi-rs/blob/main/examples/napi/src/callback.rs#L51 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I'd like to declare a function whose return type is another function.
But the compiler complains.
Is there a proper valid way?
One workaround is this.
But this requires consumer to call
res.foo()
, notres()
.To solve this issue, this solution may be used.
But this requires
#![feature]
flag, which means depending on unstable version of Rust.And I feel the first and second solutions are all boilerplate.
I just want to simply write this.
Is there a way?
Thanks :)
Beta Was this translation helpful? Give feedback.
All reactions