Lifetimes in Structs

⚓ Rust    📅 2026-02-03    👤 surdeus    👁️ 11      

surdeus

Warning

This post was published 65 days ago. The information described in this article may have changed.

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Lifetimes in Structs

What is the relation between the Person struct and name (&'a str)? what intuition should one keep in mind in general about references and lifetimes when writing code that deals with them?

pub struct Person<'a> {
    name: &'a str,
    age: i32,
}

3 posts - 3 participants

Read full topic

🏷️ Rust_feed