mirror of
https://bitbucket.org/Mattrixwv/rusttutorials.git
synced 2025-12-07 02:53:58 -05:00
Added cargo file and updated name to fit
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -2,5 +2,5 @@
|
|||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
#Ignore all executables
|
#Ignore all executables
|
||||||
*.exe
|
target/
|
||||||
|
Cargo.lock
|
||||||
|
|||||||
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[package]
|
||||||
|
name = "Tutorials"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Mattrixwv <m_ellison@ymail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
3
src/CustomTypes.rs
Normal file
3
src/CustomTypes.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
pub mod Structures;
|
||||||
|
pub mod Enums;
|
||||||
|
pub mod Constants;
|
||||||
@@ -7,7 +7,7 @@ fn is_big(n: i32) -> bool{
|
|||||||
n > THRESHOLD
|
n > THRESHOLD
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main(){
|
pub fn main(){
|
||||||
let n = 16;
|
let n = 16;
|
||||||
|
|
||||||
//Access constant in the main thread
|
//Access constant in the main thread
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
pub mod Use;
|
||||||
|
pub mod CLike;
|
||||||
|
pub mod TestCaseLinkedList;
|
||||||
|
|
||||||
|
|
||||||
//Create an `enum` to classify a web event. Note how both
|
//Create an `enum` to classify a web event. Note how both
|
||||||
//names and type information together specify the variant:
|
//names and type information together specify the variant:
|
||||||
//`PageLoad != PageUnload` and `KeyPress(char) != Paste(String)`.
|
//`PageLoad != PageUnload` and `KeyPress(char) != Paste(String)`.
|
||||||
@@ -58,5 +63,5 @@ fn main(){
|
|||||||
inspect(unload);
|
inspect(unload);
|
||||||
|
|
||||||
// We can refer to each variant via its alias, not its long and inconvenient name.
|
// We can refer to each variant via its alias, not its long and inconvenient name.
|
||||||
let x = Operations::Add;
|
//let x = Operations::Add;
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::List::*;
|
use List::*;
|
||||||
|
|
||||||
enum List{
|
enum List{
|
||||||
//Cons: Tuple struct that wraps an element and a pointer to the next node
|
//Cons: Tuple struct that wraps an element and a pointer to the next node
|
||||||
@@ -13,9 +13,11 @@ enum Work{
|
|||||||
|
|
||||||
fn main(){
|
fn main(){
|
||||||
// Explicitly `use` each name so they are available without manual scoping.
|
// Explicitly `use` each name so they are available without manual scoping.
|
||||||
use crate::Status::{Poor, Rich};
|
//use crate::Status::{Poor, Rich};
|
||||||
|
use Status::{Poor, Rich};
|
||||||
//Automatically `use` each name inside `Work`.
|
//Automatically `use` each name inside `Work`.
|
||||||
use crate::Work::*;
|
//use crate::Work::*;
|
||||||
|
use Work::*;
|
||||||
|
|
||||||
//Equivalent to `Status::Poor`.
|
//Equivalent to `Status::Poor`.
|
||||||
let status = Poor;
|
let status = Poor;
|
||||||
2
src/HelloWorld.rs
Normal file
2
src/HelloWorld.rs
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
pub mod Comments;
|
||||||
|
pub mod FormattedPrint;
|
||||||
@@ -5,6 +5,12 @@
|
|||||||
//This is a hello world program for rust
|
//This is a hello world program for rust
|
||||||
|
|
||||||
|
|
||||||
|
pub mod Debugging;
|
||||||
|
pub mod Display;
|
||||||
|
pub mod TestcaseList;
|
||||||
|
pub mod Formatting;
|
||||||
|
|
||||||
|
|
||||||
fn main(){
|
fn main(){
|
||||||
// In general, the `{}` will be automatically replaced with any
|
// In general, the `{}` will be automatically replaced with any
|
||||||
// arguments. These will be stringified.
|
// arguments. These will be stringified.
|
||||||
3
src/Primitives.rs
Normal file
3
src/Primitives.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
pub mod LiteralsAndOperators;
|
||||||
|
pub mod Tuples;
|
||||||
|
pub mod ArraysAndSlices;
|
||||||
11
src/main.rs
Normal file
11
src/main.rs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#![allow(non_snake_case)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
mod HelloWorld;
|
||||||
|
mod Primitives;
|
||||||
|
mod CustomTypes;
|
||||||
|
|
||||||
|
|
||||||
|
fn main(){
|
||||||
|
println!("Hello World");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user