Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduction to Rust 🦀 #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Rust/intro/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Rust/intro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "intro"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
46 changes: 46 additions & 0 deletions Rust/intro/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Author: NizTheDev
Date: 16/Oct/22

This is an intro project to rust.

Purpose of this is to explain the structure of rust programming language.

Prerequistites:

1. cargo // it is a package manager for rust just like npm is for nodejs.
2. rust // installation guide here: https://www.rust-lang.org/tools/install

How to run this project:

`cargo run` in the root folder of this project

Creating a similar project:
`cargo init` in the folder where you want to create the project

Basic Project Structure:

Executing `cargo init` will initialize a basic rust project which consists of the following

1. 'src' folder containing main.rs
2. Cargo.lock file
3. Cargo.toml file

Cargo.toml contains the project information and the dependencies of the project.

Cargo.lock is auto generated according to the Cargo.toml when the project is run.

By default the entry point of any rust project is src/main.rs

Rust files have .rs extention

After the prject is run with `cargo run`, the target folder is created in the root directory of the rust project which contains the binaries ( executables ).

You can also compile an individual rust file with `rustc` ( rust compiler ).

Make sure to add target folder in .gitignore file.

To get started in rust, go ahead and change the `Hello, world!` in the main.rs with your name.

For any tech related queries feel free to reach me out through nizthedev.web.app

Happy Coding!
4 changes: 4 additions & 0 deletions Rust/intro/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
// Please read the README.md in the root folder of this project
println!("Hello, world!");
}