Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [rust-lifetimes]

The tag has no usage guidance.

rust-lifetimes
5 votes
0 answers
108 views

"The parameter type `T` must be valid for the static lifetime" Only when not in `async` block

This code fails to compile use tokio_util::task::LocalPoolHandle; pub struct Test<T> { thread_pool: LocalPoolHandle, writer_provider: T, } impl<T> Test<T> { async fn ...
GamefanA's user avatar
  • 1,643
3 votes
1 answer
101 views

Why does `Option::map` work with immutable data, but not with mutable data

Why does the immutable version in the following example work, but the mutable version does not compile with error error: lifetime may not live long enough? trait Car { fn honk(&self); } ...
puaaaal's user avatar
  • 330
0 votes
1 answer
63 views

How to fix lifetime issue in Rust?

In summary, I want to have a function that digests a CSV file and depending on the existing values, it should decide with on_conflict if the current value or the new value should be used. However, I ...
Tien Do Nam's user avatar
  • 4,221