Can someone have a look at the implementation of ? somehwere?

Can someone have a look at the implementation of ? somehwere?
I’m interested whether ? is implemented via a “macro_rules”-macro. I would like to know if it is possible to write a macro that matches on a more advanced pattern. Something like:
macro_rules! try {
($var:ident = $expr:expr?; $($rest:expr);+) => …
}

 
You already invited:

Velma

Upvotes from:

since it's a language feature, it's implemented at the grammar level. it's not implemented using a macro.

Denis

Upvotes from:

Not the very same one. try! is limited to Result and nothing else, while ? desugars to a match using the Try trait, which can be used with Result, Option and in the future possibly other types.

If you wanna answer this question please Login or Register