We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
msg! macro returning value is useful for constructing async interfaces to actors:
struct AsyncFoo { child: ChildRef, } impl AsyncFoo { pub async fn open_bar(&self, open_bar: &OpenBar) -> Result<BarId, Error> { let answer = self .child .ask(open_bar) .expect("Failed to send message"); msg! { answer.await.expect("Failed to receive answer"), msg: Result<BarId, Error> => { msg; }; _: _ => Err(format_err!("wrong answer")); } } }
Currently, this code leads to compilation error, compiler sees () return type but expects Result<BarId, Error>.
()
Result<BarId, Error>
Same problem happens with explicit return inside a macro:
struct AsyncFoo { child: ChildRef, } impl AsyncFoo { pub async fn open_bar(&self, open_bar: &OpenBar) -> Result<BarId, Error> { let answer = self .child .ask(open_bar) .expect("Failed to send message"); msg! { answer.await.expect("Failed to receive answer"), msg: Result<BarId, Error> => { return msg; }; _: _ => return Err(format_err!("wrong answer")); } } }
The text was updated successfully, but these errors were encountered:
r3v2d0g
Successfully merging a pull request may close this issue.
msg! macro returning value is useful for constructing async interfaces to actors:
Currently, this code leads to compilation error, compiler sees
()
return type but expectsResult<BarId, Error>
.Same problem happens with explicit return inside a macro:
The text was updated successfully, but these errors were encountered: