From bb3e32954db26a433c4ce9ea4c91f72653979564 Mon Sep 17 00:00:00 2001 From: amitsandhel Date: Wed, 21 Jan 2026 11:37:32 -0500 Subject: [PATCH 1/5] added the rust tutorial and the pyo3 setup tutorial --- .../tutorials/Rust/PyO3Maturin.md | 35 ++++++ tmg-documentation/tutorials/Rust/index.md | 119 ++++++++++++++++++ tmg-documentation/tutorials/Rust/toc.yml | 5 + tmg-documentation/tutorials/toc.yml | 3 + 4 files changed, 162 insertions(+) create mode 100644 tmg-documentation/tutorials/Rust/PyO3Maturin.md create mode 100644 tmg-documentation/tutorials/Rust/index.md create mode 100644 tmg-documentation/tutorials/Rust/toc.yml diff --git a/tmg-documentation/tutorials/Rust/PyO3Maturin.md b/tmg-documentation/tutorials/Rust/PyO3Maturin.md new file mode 100644 index 00000000..ab188cf2 --- /dev/null +++ b/tmg-documentation/tutorials/Rust/PyO3Maturin.md @@ -0,0 +1,35 @@ +# PyO3 Maturin + +### link to Library +https://github.com/PyO3/pyo3 + + +# Introduction + + +### Installation and Setup + +``` +# (replace string_sum with the desired package name) +$ mkdir string_sum +$ cd string_sum +$ python -m venv .env +$ source .env/bin/activate +$ pip install maturin + + +Still inside this string_sum directory, now run maturin init. This will generate the new package source. When given the choice of bindings to use, select pyo3 bindings: + +$ maturin init +What kind of bindings to use? · pyo3 +Done! New project created string_sum + +``` +``` +$ maturin develop +# lots of progress output as maturin runs the compilation... +$ python +>>> import string_sum +>>> string_sum.sum_as_string(5, 20) +'25' +``` \ No newline at end of file diff --git a/tmg-documentation/tutorials/Rust/index.md b/tmg-documentation/tutorials/Rust/index.md new file mode 100644 index 00000000..38866fcb --- /dev/null +++ b/tmg-documentation/tutorials/Rust/index.md @@ -0,0 +1,119 @@ +# Rust + +Rust is a strongly typed, statically compiled systems language guaranteeing memory safety. Rust is a low level programming language designed with two main features: +- Performance: Rust is blazingly fast and is memory efficient without a garbage collector. +- Reliablility: Rust has a rich type system and ownership model that makes it memory and thread safe. + + +# Documenation Tutorial +The rust documentation: + +This link is the rust book that goes into the basics of how to use Rust going into its basic syntax, type system and the ownership, borrowed and reference model. + +https://doc.rust-lang.org/cargo/ + +Another documentation that can be helpful is this tool to install and download + +https://rustlings.rust-lang.org/ + +# Installation Instruction: + +## Tools Needed: + +- The only tool needed is Visual Studio or visual studio code. Those code editors can be installed from the following: + +- https://code.visualstudio.com/download + +- https://code.visualstudio.com/ + + +## Installing Rust Instructions +The main installation instructions can be found at this link: +- https://rust-lang.org/tools/install/ + + +The main page will then give you the terminal command lines needed to install Rust depending on your system and machine configurations. + +### Installing Rust on Windows: +On Windows will provide excecuable files you can directly download from the website and then double click to install. +With respect to Windows you may need to instal some additioanl dependices like the C++ development environment which you can easily download from the Visual Studio environment. + +Note: If your on a Windows Subsystem for Linux (WSL) you can install Rust from the following command using the terminal. +``` +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +### Installing Rust on Linux command +``` +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + + +# Cargo + +Cargo is Rust’s official efficient build system and package manager. Cargo is responsible for installing and managing packages for a given project. Cargo makes it easy to create, manage and build Rust projects. +The following commands are useful: + +To create a new project that will create a folder with the base template files: +```> cargo new hello_world + Creating binary (application) `hello_world` package +note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +``` + +The command creates the following tree: +``` +F:. +│ .gitignore +│ Cargo.lock +│ Cargo.toml +│ +└───src + main.rs +``` +As you can the command generates one folder called src that has the main basic file called main.rs file which is the main rust file. The Cargo.toml file is the file which will manage and list all +the libraries and tools you will use for your project. + Cargo.toml + +To run a rust application run the command cargo run like below + +``` +> cargo run +``` + +If you use the ls command you will see a new folder called target which stores the compiled binaries and dependenices for your project + +If you wish to just build your application and not run it you can use cargo build +``` +> cargo build +``` + +Cargo clean is used to clean the project during errors. +``` +> cargo clean +``` + +``` +> cargo doc +> cargo doc -open +``` +Cargo doc is a useful command line as it reads your rust code and automatically generates all the documentation for your project. +It productes a html file that can be opened in any browser. +With the open command the documentation is automatically opened in the browser by the system default browser. + +Here is an example of how to add libraries to the cargo. You use the command Cargo add for example +``` +> cargo add polars --features lazy,csv +``` +- Note: the features command allows you to install the libary methods you wish and need. + +Upon successful completion opening your Cargo.toml file in the text editor under dependencies will show the installed libraries +with the version. +Below is an example of a Cargo.toml file with some installed packages. +``` +[dependencies] +csv = "1.4.0" +polars = { version = "=0.51.0", features = ["lazy", "bigidx"] } +serde = "1.0.228" +``` + + \ No newline at end of file diff --git a/tmg-documentation/tutorials/Rust/toc.yml b/tmg-documentation/tutorials/Rust/toc.yml new file mode 100644 index 00000000..64526716 --- /dev/null +++ b/tmg-documentation/tutorials/Rust/toc.yml @@ -0,0 +1,5 @@ +- name: Overview + href: index.md + +- name: Python Maturin + href: PyO3Maturin.md \ No newline at end of file diff --git a/tmg-documentation/tutorials/toc.yml b/tmg-documentation/tutorials/toc.yml index 88b79ed5..5aebea31 100644 --- a/tmg-documentation/tutorials/toc.yml +++ b/tmg-documentation/tutorials/toc.yml @@ -12,3 +12,6 @@ - name: Population Zone System Conversion in QGIS href: PopZoneSysConversionQGIS/toc.yml homepage: PopZoneSysConversionQGIS/index.md +- name: Rust Tutorial + href: Rust/toc.yml + homepage: Rust/index.md From f61b3db6bcb9e70b3c2dc9c124df07546572c6ff Mon Sep 17 00:00:00 2001 From: amitsandhel Date: Wed, 21 Jan 2026 13:54:50 -0500 Subject: [PATCH 2/5] fixed the rust introduction --- tmg-documentation/tutorials/Rust/index.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tmg-documentation/tutorials/Rust/index.md b/tmg-documentation/tutorials/Rust/index.md index 38866fcb..9d31e767 100644 --- a/tmg-documentation/tutorials/Rust/index.md +++ b/tmg-documentation/tutorials/Rust/index.md @@ -1,8 +1,10 @@ # Rust -Rust is a strongly typed, statically compiled systems language guaranteeing memory safety. Rust is a low level programming language designed with two main features: -- Performance: Rust is blazingly fast and is memory efficient without a garbage collector. -- Reliablility: Rust has a rich type system and ownership model that makes it memory and thread safe. +Rust is a strongly typed, memory-safe system programming language designed to ensure high performance without sacrificing +safety. It emphasizes concurrent programming, providing mechanisms to prevent data races at compile time. +Rust’s ownership model, combined with strict compile-time checks, allows developers to write robust and efficient code with +a focus on reliability, speed, and maintainability. Its expressive syntax, rich standard library, +and modern tooling make Rust suitable for both system-level development and high-level application programming. # Documenation Tutorial @@ -23,8 +25,8 @@ https://rustlings.rust-lang.org/ - The only tool needed is Visual Studio or visual studio code. Those code editors can be installed from the following: - https://code.visualstudio.com/download - - https://code.visualstudio.com/ +- https://visualstudio.microsoft.com/downloads/ ## Installing Rust Instructions From 1bf66346006ebd14f4023abedf93878abe2f0544 Mon Sep 17 00:00:00 2001 From: amitsandhel Date: Wed, 21 Jan 2026 14:02:18 -0500 Subject: [PATCH 3/5] fixed the header tags --- tmg-documentation/tutorials/Rust/PyO3Maturin.md | 6 ++---- tmg-documentation/tutorials/Rust/index.md | 12 ++++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tmg-documentation/tutorials/Rust/PyO3Maturin.md b/tmg-documentation/tutorials/Rust/PyO3Maturin.md index ab188cf2..c06e70c1 100644 --- a/tmg-documentation/tutorials/Rust/PyO3Maturin.md +++ b/tmg-documentation/tutorials/Rust/PyO3Maturin.md @@ -1,10 +1,8 @@ # PyO3 Maturin -### link to Library -https://github.com/PyO3/pyo3 - -# Introduction +## link to Library +https://github.com/PyO3/pyo3 ### Installation and Setup diff --git a/tmg-documentation/tutorials/Rust/index.md b/tmg-documentation/tutorials/Rust/index.md index 9d31e767..570fd59e 100644 --- a/tmg-documentation/tutorials/Rust/index.md +++ b/tmg-documentation/tutorials/Rust/index.md @@ -1,5 +1,6 @@ -# Rust +# Overview +## Rust Rust is a strongly typed, memory-safe system programming language designed to ensure high performance without sacrificing safety. It emphasizes concurrent programming, providing mechanisms to prevent data races at compile time. Rust’s ownership model, combined with strict compile-time checks, allows developers to write robust and efficient code with @@ -7,7 +8,7 @@ a focus on reliability, speed, and maintainability. Its expressive syntax, rich and modern tooling make Rust suitable for both system-level development and high-level application programming. -# Documenation Tutorial +## Documenation Tutorial The rust documentation: This link is the rust book that goes into the basics of how to use Rust going into its basic syntax, type system and the ownership, borrowed and reference model. @@ -18,9 +19,9 @@ Another documentation that can be helpful is this tool to install and download https://rustlings.rust-lang.org/ -# Installation Instruction: +## Installation Instruction: -## Tools Needed: +### Tools Needed: - The only tool needed is Visual Studio or visual studio code. Those code editors can be installed from the following: @@ -50,8 +51,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` - -# Cargo +## Cargo Cargo is Rust’s official efficient build system and package manager. Cargo is responsible for installing and managing packages for a given project. Cargo makes it easy to create, manage and build Rust projects. The following commands are useful: From f7c98149ad34817ba72023b56eb7e2e1947908bc Mon Sep 17 00:00:00 2001 From: amitsandhel Date: Wed, 21 Jan 2026 14:18:37 -0500 Subject: [PATCH 4/5] fixed errors --- tmg-documentation/tutorials/Rust/index.md | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/tmg-documentation/tutorials/Rust/index.md b/tmg-documentation/tutorials/Rust/index.md index 570fd59e..2b3518c5 100644 --- a/tmg-documentation/tutorials/Rust/index.md +++ b/tmg-documentation/tutorials/Rust/index.md @@ -8,25 +8,19 @@ a focus on reliability, speed, and maintainability. Its expressive syntax, rich and modern tooling make Rust suitable for both system-level development and high-level application programming. -## Documenation Tutorial -The rust documentation: +## The rust documentation: -This link is the rust book that goes into the basics of how to use Rust going into its basic syntax, type system and the ownership, borrowed and reference model. +* [Rust Book](https://doc.rust-lang.org/cargo/) - This link is the rust book that goes into the both the basics and advanced concepts of how to use Rust. +* [Rustlings](https://rustlings.rust-lang.org/) - An online (or optionally offline) tool to learn Rust through a series of problems. -https://doc.rust-lang.org/cargo/ +## Installation Instruction: -Another documentation that can be helpful is this tool to install and download - -https://rustlings.rust-lang.org/ - -## Installation Instruction: ### Tools Needed: -- The only tool needed is Visual Studio or visual studio code. Those code editors can be installed from the following: - +- You do need a code editor and choose any code editor of your choosing. The two recommended code editors are Visual Studio(Windows) +or Visual Studio Code. Download links provided below: - https://code.visualstudio.com/download -- https://code.visualstudio.com/ - https://visualstudio.microsoft.com/downloads/ @@ -41,11 +35,6 @@ The main page will then give you the terminal command lines needed to install Ru On Windows will provide excecuable files you can directly download from the website and then double click to install. With respect to Windows you may need to instal some additioanl dependices like the C++ development environment which you can easily download from the Visual Studio environment. -Note: If your on a Windows Subsystem for Linux (WSL) you can install Rust from the following command using the terminal. -``` -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -``` - ### Installing Rust on Linux command ``` curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh From b25be0c742cd0b4b244b8cc8387d3ada18490be5 Mon Sep 17 00:00:00 2001 From: amitsandhel Date: Wed, 21 Jan 2026 14:30:57 -0500 Subject: [PATCH 5/5] fix spelling --- tmg-documentation/tutorials/Rust/index.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tmg-documentation/tutorials/Rust/index.md b/tmg-documentation/tutorials/Rust/index.md index 2b3518c5..7795f564 100644 --- a/tmg-documentation/tutorials/Rust/index.md +++ b/tmg-documentation/tutorials/Rust/index.md @@ -18,10 +18,10 @@ and modern tooling make Rust suitable for both system-level development and high ### Tools Needed: -- You do need a code editor and choose any code editor of your choosing. The two recommended code editors are Visual Studio(Windows) +You do need a code editor and choose any code editor of your choosing. The two recommended code editors are Visual Studio(Windows) or Visual Studio Code. Download links provided below: -- https://code.visualstudio.com/download -- https://visualstudio.microsoft.com/downloads/ +* [Visual Studio Code](https://code.visualstudio.com/download) - Windows, Mac and Linux +* [Visual Studio](https://visualstudio.microsoft.com/downloads/) - Windows only ## Installing Rust Instructions @@ -32,18 +32,20 @@ The main installation instructions can be found at this link: The main page will then give you the terminal command lines needed to install Rust depending on your system and machine configurations. ### Installing Rust on Windows: -On Windows will provide excecuable files you can directly download from the website and then double click to install. -With respect to Windows you may need to instal some additioanl dependices like the C++ development environment which you can easily download from the Visual Studio environment. +On Windows, the application is distributed as a downloadable executable file. After downloading it from the website, +you can install it by double‑clicking the file. + + -### Installing Rust on Linux command +### Installing Rust on Linux: +On Linux, the application gives you a command you can copy paste into your terminal and click enter to run. ``` curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` ## Cargo - -Cargo is Rust’s official efficient build system and package manager. Cargo is responsible for installing and managing packages for a given project. Cargo makes it easy to create, manage and build Rust projects. -The following commands are useful: +Cargo is Rust’s official build system and package manager, providing an efficient way to install, manage, and compile project dependencies. It streamlines the process of creating, organizing, and building Rust projects. +The following commands are particularly useful: To create a new project that will create a folder with the base template files: ```> cargo new hello_world