File tree 4 files changed +35
-1
lines changed
4 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -97,3 +97,7 @@ path = "Experiments/NatuurkundeModellen/NatuurkundeModellen.rs"
97
97
[[bin ]]
98
98
name = " GenericTypesTraitsLifetimes"
99
99
path = " Experiments/GenericTypesTraitsLifetimes/GenericTypesTraitsLifetimes.rs"
100
+
101
+ [[bin ]]
102
+ name = " Lifetimes"
103
+ path = " Experiments/Lifetimes/Lifetimes.rs"
Original file line number Diff line number Diff line change
1
+ #![ allow( non_snake_case) ]
2
+ mod OutOfScope ;
3
+
4
+ /// lifetimesmsmsmsms
5
+ fn main ( ) {
6
+ // OutOfScope::main();
7
+ }
Original file line number Diff line number Diff line change
1
+ pub fn main ( ) {
2
+ let r;
3
+
4
+ {
5
+ let x = 5 ; // WE create x that will be dropped later.
6
+ r = & x; // We create a reference to x.
7
+ // Because x gets out of scop, the reference to it (which is stored in r) becomes broken. x doesn't live long enough.
8
+ }
9
+
10
+ println ! ( "r: {}" , r) ;
11
+ }
Original file line number Diff line number Diff line change @@ -23,4 +23,16 @@ Make sure Cargo.toml stays tidy as the script will append the new experiment to
23
23
I'm learning Rust because I want to learn a new language.
24
24
I see C being used a lot, and I want to learn a language that is similar to C, but with more modern features.
25
25
I also want to learn a language that has a good package manager and build system, and has a vibrant community.
26
- Rust seems to mark all the boxes.
26
+ Rust seems to mark all the boxes.
27
+
28
+
29
+ ## Resources:
30
+
31
+ * [ The Rustonomicon] ( https://doc.rust-lang.org/nomicon/ )
32
+ * The Rustonomicon digs into all the awful details that you need to understand when writing Unsafe Rust programs.*
33
+ * [ Rust by Example] ( https://doc.rust-lang.org/rust-by-example/ )
34
+ * Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries.*
35
+ * [ The Rust Programming Language Book] ( https://doc.rust-lang.org/book/ )
36
+ * The Rust Programming Language is the official book about Rust, made by everyone.*
37
+ * [ Rustlings] ( https://rustlings.cool/ )
38
+ * Small exercises to get used to reading, writing and debugging Rust code.*
You can’t perform that action at this time.
0 commit comments