Rust Book exercises

Learning how 2 Rust with The Book™!

Binaries

Ch. 05: Using Structs to Structure Related Data

Create Rectangle structs with methods that operate on their own instance. Enter the dimensions for two rectangles and learn if the second Rectangle fits into the first. cargo run --bin ch_05_rectangles

Ch. 08: Common Collections

Interactive company directory program from the end of chapter 8. Demonstrates collections such as Vec, HashMap to store user input. Prompts you to create a new Company where you can create departments which employees can be added to. You can retreive an alphabetically sorted list of employee names per department. cargo run --bin ch_08_company

Ch. 12: An I/O Project: Building a Command Line Program

Run the grep clone binary. First argument is the search query, second is the file to search.
cargo run --bin ch_12_minigrep "to" ./poem.txt

Minigrep is case-sensitive by default. Pass the --case-insensitive flag (or -c for short) to perform case-insensitive search. cargo run --bin ch_12_minigrep "somEbOdY" --case-insensitive ./poem.txt ^^^^^^^^^^^^^^^^^^

Alernatively the CASE_INSENSITIVE env var will be checked to determine search case sensetivity setting. Flags take precendence.
CASE_INSENSITIVE=1 cargo run --bin ch_12_minigrep "to" ./poem.txt ^^^^^^^^^^^^^^^^^^

Libraries

Run the unit and integration tests. ``` cargo test

running 29 tests test util::sorting::selection ... ok
test ch05::tests::largercanholdsmaller ... ok
test ch05::tests::smallercanholdlarger ... ok
test ch08::math::calculatemean ... ok
test ch08::math::calculatemedian ... ok
test ch08::math::calculatemode ... ok
test ch08::piglatinconverter::convertstopiglatin ... ok
test ch09::tests::guesspanicsifoutsiderange ... ok
test ch
10::traits::pointmixes ... ok
test ch
10::traits::returngenericlargest ... ok
test ch10::traits::summarizetrait ... ok
test ch10::traits::summarizetraitdefaultimpl ... ok
test ch10::traits::traitboundsandparameters ... ok
test ch11::adder::adderadds ... ok
test ch11::adder::twoplustwo ... ignored
test ch
11::adder::flakeytest ... FAILED <-------------- might have to try this one a few times test ch11::adder::greetergreets ... ok
test ch
11::adder::testreturnsresult ... ok
test ch12::minigreptests::oneresult ... ok test ch12::minigreptests::multipleresults ... ok test ch12::minigreptests::searchescaseinsensitive ... ok test ch13::closures::expensivefunction ... ok test ch13::customworkoutbuilder::closureownsitsenv ... ok test ch13::customworkoutbuilder::cachercaches ... ok test ch13::customworkoutbuilder::cacheropsongenericclosures ... FAILED <-- bypassed bc I can't figure out how to make explicity typed closures use generics :( test ch13::customworkoutbuilder::iteratoradapters ... ok test ch13::customworkoutbuilder::iteratorsiterate ... ok test ch13::customworkoutbuilder::iteratorssum ... ok test ch13::customiterator::countercounts ... ok test ch13::customiterator::chainingmyriaditerator_methods ... ok

Running target/debug/deps/integration_test-3d1ca2eca157be7d

running 1 test test sortvecascending ... ok

// documentation tests running 3 tests test src/lib/ch12.rs - ch12::minigrep::searchcaseinsensitive (line 111) ... ok test src/lib/ch12.rs - ch12::minigrep::searchcasesensitive (line 78) ... ok test src/lib/ch14.rs - ch14::art::utils::mix (line 27) ... ok

```