Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
Rust
/
Lifetimes
What does fn choose<'a>(x: &'a str, y: &'a str) -> &'a str mean?
from Lifetimes
Rust 1.98
intermediate
1 min
What does fn choose<'a>(x: &'a str, y: &'a str) -> &'a str mean?
Both inputs must be valid for a caller-chosen region in which the result is used.
Both owners must be created and destroyed in the same lexical block.
The annotation extends the shorter owner to match the longer one.
The result is guaranteed to come from x.
Check
Ask AI about this kata
Report an error
next kata
When is a for-lifetime higher-ranked bound appropriate?
Quiz
A new version is available
Reload