What do you call this type syntax?


#1

I’m looking at some example Rust in Exercism and am not sure what to call this:

pub fn anagrams_for<'a>(word: &str, inputs: &[&'a str]) -> Vec<&'a str> {
///not necessary
}

This 'a str stuff is clearly something to do with Types, but it’s not syntax that I’m familiar with. And since I don’t have a name for it, it’s really hard to search for!

Thanks


#2

The 'a is a lifetime; sometimes referred to as “lifetime variable”, “lifetime parameter”, or “named lifetime”.


#3

Thanks! Exactly what I needed.