We will be testing this homework using Rust 1.66.1. The 1.66.1 version is only a security update from Rust 1.66.0, so your code will still be compatible with the autograder’s compiler if you use 1.66.0.
In this homework, we will continue to tinker with ownership, borrowing, and lifetime, as well as exercise on error handling, traits, and iterators. We also have two bonus exercises on concurrency and unsafe.
To get started, clone the starter code:
src/lib.rs file in your favorite code editor. Find all the
todo!()s and replace with your implementation code as required by the
The requirement in the comments are written in markdown, and can be compiled into HTML (see more). Run the following command to compile the docs.
--open option tells cargo to open the HTML document in a browser, and you
will see a local webpage opened in your browser.
--document-private-items option also generates documentation for private
The repository is structured as a library-only project. It does not compile
into any standalone executable files. To test the correctness of your code, run
cargo test --release in the command line. You will see test framework output
showing what cases have passed and failed, and also output the reason for the
Requirement: In this homework, you should not:
- use any
unsafecode (except Exercise 6)
#![...]options to the beginning of the file or module
- change any definition
You can modify the test cases, and also add your own test cases.
Note: the official test cases on Gradescope will be different from the sample test cases in the starter code. Therefore, you may want to add your own test cases to test more exhaustively.
This homework is due on January 22nd, 2023 at 23:59pm.
Submit only the
lib.rs file to Gradescope.