Move tons of stuff into oldstuff/

This commit is contained in:
2020-06-04 09:54:59 -04:00
parent 49038bb8ef
commit aa1345b6ed
213 changed files with 0 additions and 12 deletions

2
rustbook/.gitignore vendored
View File

@@ -1,2 +0,0 @@
*/target/
*/Cargo.lock

View File

@@ -1,6 +0,0 @@
[package]
name = "branches"
version = "0.1.0"
authors = ["Dan Buch <daniel.buch@gmail.com>"]
[dependencies]

View File

@@ -1,6 +0,0 @@
fn main() {
for number in (1..4).rev() {
println!("{}!", number);
}
println!("LIFTOFF!!!");
}

View File

@@ -1,6 +0,0 @@
[package]
name = "communicator"
version = "0.1.0"
authors = ["Dan Buch <dan@meatballhat.com>"]
[dependencies]

View File

@@ -1,2 +0,0 @@
pub fn connect() {
}

View File

@@ -1,13 +0,0 @@
pub mod client;
pub mod network;
#[cfg(test)]
mod tests {
use super::client;
#[test]
fn it_works() {
client::connect();
}
}

View File

@@ -1,5 +0,0 @@
extern crate communicator;
fn main() {
communicator::client::connect();
}

View File

@@ -1,4 +0,0 @@
pub fn connect() {
}
pub mod server;

View File

@@ -1,2 +0,0 @@
pub fn connect() {
}

View File

@@ -1,6 +0,0 @@
[package]
name = "functions"
version = "0.1.0"
authors = ["Dan Buch <daniel.buch@gmail.com>"]
[dependencies]

View File

@@ -1,9 +0,0 @@
fn main() {
let x = plus_one(5);
println!("The value of x is: {}", x);
}
fn plus_one(x: i32) -> i32 {
x + 1
}

View File

@@ -1,2 +0,0 @@
target/
Cargo.lock

View File

@@ -1,7 +0,0 @@
[package]
name = "guessing_game"
version = "0.1.0"
authors = ["Dan Buch <daniel.buch@gmail.com>"]
[dependencies]
rand = "0.4.0"

View File

@@ -1,37 +0,0 @@
extern crate rand;
use std::cmp::Ordering;
use std::io;
use rand::Rng;
fn main() {
println!("Guess the number!");
let secret_number = rand::thread_rng().gen_range(1, 101);
loop {
println!("Please input your guess.");
let mut guess = String::new();
io::stdin()
.read_line(&mut guess)
.expect("Failed to read line");
let guess: u32 = match guess.trim().parse() {
Ok(num) => num,
Err(_) => continue,
};
println!("You guessed: {}", guess);
match guess.cmp(&secret_number) {
Ordering::Less => println!("Too small!"),
Ordering::Greater => println!("Too big!"),
Ordering::Equal => {
println!("You win!");
break;
}
}
}
}

View File

@@ -1,2 +0,0 @@
/target/
Cargo.lock

View File

@@ -1,6 +0,0 @@
[package]
name = "hello_cargo"
version = "0.1.0"
authors = ["Dan Buch <daniel.buch@gmail.com>"]
[dependencies]

View File

@@ -1,3 +0,0 @@
fn main() {
println!("Hello, world!");
}

Binary file not shown.

View File

@@ -1,3 +0,0 @@
fn main() {
println!("Hello, world!");
}

View File

@@ -1,6 +0,0 @@
[package]
name = "ownership"
version = "0.1.0"
authors = ["Dan Buch <daniel.buch@gmail.com>"]
[dependencies]

View File

@@ -1,26 +0,0 @@
fn main() {
let s = String::from("hello world");
let word = first_word(&s[..]);
println!("word={}", word);
let l = "hello world";
let word = first_word(&l[..]);
println!("word={}", word);
let word = first_word(l);
println!("word={}", word);
}
fn first_word(s: &str) -> &str {
let bytes = s.as_bytes();
for (i, &item) in bytes.iter().enumerate() {
if item == b' ' {
return &s[0..i];
}
}
&s[..]
}

View File

@@ -1,6 +0,0 @@
[package]
name = "panic"
version = "0.1.0"
authors = ["Dan Buch <dan@meatballhat.com>"]
[dependencies]

View File

@@ -1,5 +0,0 @@
fn main() {
let v = vec![1, 2, 3];
v[100];
}

View File

@@ -1,6 +0,0 @@
[package]
name = "rectangles"
version = "0.1.0"
authors = ["Dan Buch <daniel.buch@gmail.com>"]
[dependencies]

View File

@@ -1,33 +0,0 @@
#[derive(Debug)]
struct Rectangle {
width: u32,
height: u32,
}
impl Rectangle {
fn area(&self) -> u32 {
self.width * self.height
}
fn can_hold(&self, other: &Rectangle) -> bool {
self.width > other.width && self.height > other.height
}
fn square(size: u32) -> Rectangle {
Rectangle { width: size, height: size }
}
}
fn main() {
let rect1 = Rectangle { width: 30, height: 50 };
let rect2 = Rectangle { width: 10, height: 40 };
let rect3 = Rectangle { width: 60, height: 45 };
let rect4 = Rectangle::square(3);
println!("Can rect1 hold rect2? {}", rect1.can_hold(&rect2));
println!("Can rect1 hold rect3? {}", rect1.can_hold(&rect3));
for (i, rect) in [rect1, rect2, rect3, rect4].iter().enumerate() {
println!("rect{} has area {}", i+1, rect.area());
}
}

View File

@@ -1,6 +0,0 @@
[package]
name = "variables"
version = "0.1.0"
authors = ["Dan Buch <daniel.buch@gmail.com>"]
[dependencies]

View File

@@ -1,9 +0,0 @@
fn main() {
let x = 5;
let x = x + 1;
let x = x * 2;
println!("The value of x is: {}", x);
}