Reputation: 3573
Here's my code:
struct Server<'a> {
port: &'a u16,
}
impl Server {
fn connect() {
//stuff
}
}
The error I'm getting is with the impl
block:
error: wrong number of lifetime parameters: expected 1, found 0 [E0107]
I had to add a lifetime parameter to Server
to allow the u16
slice but I do not know how to add one for an impl
block.
Upvotes: 6
Views: 2021
Reputation: 38576
You need to have the lifetime annotation on the implementation as well.
impl<'a> Server<'a> {
fn connect() {
//stuff
}
}
Upvotes: 7