cljacoby / pyproj

A CLI for python projects
MIT License
0 stars 0 forks source link

What do the lifetime parameters on the parser functions actually do? #6

Open cljacoby opened 4 years ago

cljacoby commented 4 years ago

This project is a learning experience with rust, and at the moment I admittedly don't really understand how lifetime parameters work. I understand the concept, but not how the syntax actually explains the lifetime of objects.

For the various parser_* functions in cli.rs, I added lifetime parameters, because it seemed like that's what the compiler wanted. I'd like to understand the specifics of:

pub fn parser_cmd_new() -> App<'a, 'b> { ... }
pub fn parser_cmd_new<'a, 'b>() -> App<'a, 'b> { ... }

And why this change let the code compile.