randomPoison / thespian

An experiment in designing an ergonomic actor framework for Rust
1 stars 0 forks source link

More robust support for patterns in actor method arguments #5

Closed randomPoison closed 4 years ago

randomPoison commented 4 years ago

Currently the #[thespian::actor] procedural macro breaks when dealing with functions with more complex patterns for function arguments, e.g.

pub fn mut_arg(&self, mut val: String) {}

pub fn patter_arg(&self, (foo, bar): (usize, usize)) {}

To address this, the parsing logic now extracts both an identifier and a type for each argument. If the argument is an ident pattern, the generated code uses the provided ident. For all other pattern types, the parser generates a new identifier based on the position of the argument.