thunder
thunder copied to clipboard
Lifetime parameters on functions cause `thunderclap` attribute to panic
For example, it's not clear how to run app with more than one parameter:
/// App
#[thunderclap]
impl App {
/// run
fn run<'a, 'b>(token: &'a str, listening_address: &'b str) {
println!("Hello {}, my address is {}", token, listening_address);
}
}
error[E0599]: no function or associated item named `run` found for type `clap::App<'_, '_>` in the current scope
--> src\main.rs:28:1
|
28 | #[thunderclap]
| ^^^^^^^^^^^^^^ function or associated item not found in `clap::App<'_, '_>`
error: aborting due to previous error
Hey, you don't need to specify the lifetime parameters on that function. If you look at the thor
example you'll see that the hello
function takes a name: &str
but because it is never returned from that function the lifetime is very clear.
I'll rename this issue because this is a bug in how thunder
parses user code and I think it can't handle lifetime parameters on functions and there should be at least some sort of error message that is more helpful to the user.
@spacekookie i thought you cannot not specify lifetime parameters because they lifetimes cannot be elised. Sorry, the error message misled me.