remove the ex*.rs files
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
// ex1.rs
|
||||
// Make me compile! :)
|
||||
|
||||
fn main() {
|
||||
println();
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// ex2.rs
|
||||
// Make me compile!
|
||||
|
||||
fn something() -> String {
|
||||
"hi!"
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("{}", something());
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// ex3.rs
|
||||
// Make me compile!
|
||||
|
||||
struct Foo {
|
||||
capacity: i32,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("{:?}", Foo { capacity: 3 });
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// ex4.rs
|
||||
// Make me compile!
|
||||
|
||||
fn something() -> Result<i32, std::num::ParseIntError> {
|
||||
let x:i32 = "3".parse();
|
||||
Ok(x * 4)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
match something() {
|
||||
Ok(..) => println!("You win!"),
|
||||
Err(e) => println!("Oh no something went wrong: {}", e),
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
// ex5.rs
|
||||
// Make me compile!
|
||||
|
||||
enum Reaction<'a> {
|
||||
Sad(&'a str),
|
||||
Happy(&'a str),
|
||||
}
|
||||
|
||||
fn express(sentiment: Reaction) {
|
||||
match sentiment {
|
||||
Reaction::Sad(s) => println!(":( {}", s),
|
||||
Reaction::Happy(s) => println!(":) {}", s),
|
||||
}
|
||||
}
|
||||
|
||||
fn main () {
|
||||
let x = Reaction::Happy("It's a great day for Rust!");
|
||||
express(x);
|
||||
express(x);
|
||||
let y = Reaction::Sad("This code doesn't compile yet.");
|
||||
express(y);
|
||||
}
|
||||
Reference in New Issue
Block a user