book-exploring-async-basics
book-exploring-async-basics copied to clipboard
[Translation] 7_0_introducing_our_main_example
Now the parameter
_resis an argument that is passed into our callback. In javascript it would be left out, but since we use a typed language we have created a type calledJs.
So you wanted to make use of enum in Rust to unify the parameter _res, right?
In the case of
set_timeoutit'sJs::undefined. In the case ofFs::readit's anJs::Stringand so on.
And it in the sentence above refers to the type of parameter _res.
So you wanted to make use of enum in Rust to unify the parameter _res, right?
Yes
And it in the sentence above refers to the type of parameter _res.
Yes, that's right.