Skip to content

Commit 548e765

Browse files
committed
added lifetime example
1 parent c4499d4 commit 548e765

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ in a controlled repository now.
1111
* `strings.rs`: string and str examples
1212
* `iterators.rs`: iterator examples
1313
* `closures.rs`: closure examples
14+
* `lifetimes.rs`: simple lifetime example

lifetimes.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
fn call_me() -> &'static u64 {
2+
let y = 5;
3+
return &y;
4+
}
5+
6+
fn main() {
7+
println!("{}", call_me());
8+
}

0 commit comments

Comments
 (0)