This guide provides step-by-step instructions to install and run the projects in this repository.
The projects in this repository are written in Rust. Thus, the Rust compiler and Cargo, Rust's package manager and build system, are required to build and run these projects.
Follow these steps to install Rust and Cargo:
-
Open a terminal or command line interface.
-
Download and install
rustup
, Rust's toolchain installer, by running the following command:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
The above command will download a script and start the installation of the
rustup
toolchain installer. You can proceed with the default installation by simply pressing "1" and then "Enter". -
Close the terminal and reopen it.
-
Verify the installation by checking the versions of Rust and Cargo with the following commands:
rustc --version cargo --version
This repository contains three projects: ask1
, ask2
, and ask3
. Each can be built and run with Cargo. Here are the general steps for each project:
-
Clone the repository with the following command:
git clone https://github.com/Mauragkas/Project.git
-
Navigate to the directory of the project. For example, for
ask1
, run:cd Project/PartA/ask1
-
Build the project with Cargo:
cargo build
This command will download and compile the project's dependencies, and then compile the project itself.
-
Run the project with Cargo:
cargo run
This command will run the compiled project.
Repeat these steps for each project (ask1
, ask2
, and ask3
), replacing the project directory in step 2 as necessary.
Please note that these instructions assume you're using a Unix-like environment (Linux, MacOS, WSL on Windows). If you're using native Windows, some steps might be slightly different.
If you're using native Windows (not the Windows Subsystem for Linux), the installation of rustup
is a bit different:
- Visit the Rust downloads page and download the
rustup-init.exe
executable for Windows. - Run the
rustup-init.exe
and follow the onscreen instructions. Just like in Unix environments, you can usually proceed with the default installation by pressing "1" and then "Enter". - After the installation completes, you might need to manually add the Rust and Cargo binaries to your system PATH. The installer will provide instructions for this if necessary.
- Restart your command line or PowerShell window.
- Verify the installation by running
rustc --version
andcargo --version
.
For cloning the repository and navigating to the project directories, Windows users can use the command line or PowerShell in the same way as described above. However, you might need to adjust the file paths depending on where you clone the repository and your current directory.
For example, if you clone the repository into your Documents
folder, the command to navigate to the ask1
directory might look like this in PowerShell:
cd .\Documents\Project\PartA\ask1\
The cargo build and cargo run commands work the same way in Windows as they do in Unix environments.
After building each project, it's recommended to run the provided tests to ensure that the project is functioning as expected.
-
Navigate to the directory of the project you want to test. Using
ask1
as an example:cd Project/PartA/ask1
-
Run the tests using Cargo:
cargo test
This command will compile and run all the tests associated with the project. Cargo will display the results of each test, informing you whether they've passed or failed.
-
If all tests pass, you can proceed with running the project as described in the earlier section. If some tests fail, it may indicate an issue with the code or the environment. Refer to the test output and project documentation for troubleshooting tips.
Remember to run the tests for each project (ask1
, ask2
, and ask3
) before executing them.