syn icon indicating copy to clipboard operation
syn copied to clipboard

`parse` should take a `&mut ParseStream`

Open rambip opened this issue 1 year ago • 2 comments

Maybe there is an obvious reason, but I was not able to find any justification, so I will ask my question here. Forgive me if it is naive.

Why does the parse function in the trait Parse take an immutable reference to a ParseStream ? I had to read the docs for hours before understanding that each time you call parse, the stream mutates (It is never explained in the examples).

Since the parse function really mutates its input, I think it would be clearer to change its signature ... And since the user entry-point is parse_macro_input!, I don't think it would change a lot of things for the user.

rambip avatar Jul 08 '23 18:07 rambip