Apostrophe with example

According to Non-operator Symbols Apostrophe means "Named lifetime or loop label".
I need some example of apostrophe, Can you example me to show me importance of apostrophe?

fn has_lifetime<'a>(input: &'a u8) -> &'a u8 { input }

fn break_with_label() {
    'l: loop {
        break 'l;
    }
}
1 Like

There is a sub-chapter in the book about lifetimes with some examples: Validating References with Lifetimes - The Rust Programming Language

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.