first bit of guessing game ch2

This commit is contained in:
LuKe Tidd 2022-12-12 08:32:03 -05:00
parent 3910c48801
commit 62db5419f0
Signed by: luke
GPG Key ID: 75D6600BEF4E8E8F
38 changed files with 54 additions and 0 deletions

7
guessing_game/Cargo.lock generated Normal file
View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "guessing_game"
version = "0.1.0"

8
guessing_game/Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "guessing_game"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

26
guessing_game/src/main.rs Normal file
View File

@ -0,0 +1,26 @@
// some things are automatically loaded in every rust program
// https://doc.rust-lang.org/std/prelude/index.html
// for extras, import them with `use`:
use std::io;
fn main() {
println!("Guess the number!");
println!("input your guess");
// vars are immutable by default, change this
// The :: syntax in the ::new line indicates that new is an _associated function_ of the String
// a function thats implemented on a type
let mut guess = String::new();
// could still call this without importing it via std::io::stdin
// this can be one line, it is broken up for readability.
io::stdin()
// & indicates that this argument is a reference,
// references are also immutable by default so &mut is needed
.read_line(&mut guess)
// expect handles the Err variant by crashing the program. There are other ways to handle
// errors.
.expect("Failed to read line");
// read_line returns a `result` value. result is an enum. Each possible state is a variant.
// Result's variants are Ok and Err
println!("you guessed: {guess}");
}

View File

@ -0,0 +1 @@
{"rustc_fingerprint":2873261240282726551,"outputs":{"10376369925670944939":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/luket/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"llvm14-builtins-abi\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.67.0-nightly (7eef946fc 2022-11-06)\nbinary: rustc\ncommit-hash: 7eef946fc0e0eff40e588eab77b09b287accbec3\ncommit-date: 2022-11-06\nhost: x86_64-unknown-linux-gnu\nrelease: 1.67.0-nightly\nLLVM version: 15.0.4\n","stderr":""},"15697416045686424142":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n","stderr":""}},"successes":{}}

View File

@ -0,0 +1,3 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/

View File

View File

@ -0,0 +1 @@
{"rustc":15234846723159686366,"features":"[]","target":18246892274002150725,"profile":9251013656241001069,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/guessing_game-3f658c19dd973748/dep-bin-guessing_game"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}

View File

@ -0,0 +1 @@
This file has an mtime of when this was started.

View File

@ -0,0 +1,5 @@
/home/luket/git/rust/guessing_game/target/debug/deps/guessing_game-3f658c19dd973748: src/main.rs
/home/luket/git/rust/guessing_game/target/debug/deps/guessing_game-3f658c19dd973748.d: src/main.rs
src/main.rs:

Binary file not shown.

View File

@ -0,0 +1 @@
/home/luket/git/rust/guessing_game/target/debug/guessing_game: /home/luket/git/rust/guessing_game/src/main.rs