Re:Programming in Rust: the good, the bad, the ugly
by steveklabnik on Wednesday March 13, 2019 @12:00AM
(#19375607)
At most, you’d have to propagate a <‘_>; the lifetime is part of the type and showing it matters for the same reason showing any other type parameter matters.
Re:Programming in Rust: the good, the bad, the ugly
by andrenth on Tuesday March 12, 2019 @11:53PM
(#19375573)
Well let’s say you read command line args into a Vec<String> and then you want to use each in some Foo struct, but you want to avoid clones, so you make the field a &str. Now your Foo must become Foo<‘a> everywhere.
I understand the guarantees, it’s just the syntactic overhead that annoys me.
However, in many cases, you probably just want a Box or something instead of a borrow within a struct. Do you have a specific example where you want a borrow?