Pinned toot

Hello world, as I learn about Rust, I will be posting simple facts on Rust language. Toot to you later!

------------------
Rust has the following built-in simple data types:
i8, i16, i32, i64 (integers)
u8, u16, u32, u64 (unsigned integers)
isize, usize, (pointer size integer/unsigned)
f32, f64 (floating point)
char (a unicode character)
bool (true/false)

-----------------------
Please reply to report error rust:1000

------------------
rust macro println!("...") is based on the rust macro format!("...").
Print version prints on the stdio whereas the format will print on a std::String.

rust println/format macros also allow convenient formatting in binary and hexadecimal.

println!("0x{:04X}", 1000); will print 0x03E8 and
println!("b'{:08b}'", 2); will print b'00000010' as an example.

-----------------------
Please reply to report error rust:1008

-1008

rust macro println!("...") is based on the rust macro format!("...").
Print version prints on the stdio whereas the format will print on a std::String.

rust println/format macros also allow convenient formatting in binary and hexadecimal.

println!("0x{:04X}", 1000); will print 0x03E8 and
println!("b'{:08b}'", 2); will print b'00000010' as an example.

-1004

Rust uses structs , tuples and enumerations
to offer composite data-types beyond the basic data-types.
Structs are similar to c++ structs,
tuples are similar to python tuples,
enumerations are more advanced than c++ enum class as they
can contain parameters and pair up smartly with a matching
construct to process enumeration driven differences.

-1012

The following rust code shows:
- to get the size of a variable use size_of_val(&T) from mem module
- {:b} allows easy formatting to see binary memory representations
- macro names in rust end with "!"

let mut t: char = 'A';
println!("t is the char {}, {:032b}, {}",t, t as u32, t as u32);
t = 'Ộ';
println!("t is {}, t has size {}",t, mem::size_of_val(&t));

PRINTS the following :

t is the char A, 00000000000000000000000001000001, 65
t is Ộ, t has size 4

-1012

The following rust code shows:
- to get the size of a variable use size_of_val(&T) from mem module
- {:b} allows easy formatting to see binary memory representations
- macro names in rust end with "!"

let mut t: char = 'A';
println!("t is the char {}, {:032b}, {}",t, t as u32, t as u32);
t = 'Ộ';
println!("t is {}, t has size {}",t, mem::size_of_val(&t));

PRINTS the following :

t is the char A, 00000000000000000000000001000001, 65
t is Ộ, t has size 4

-1005

rust installation comes with a whole programming book.
To access the html version of the book in your local environment just type:

rustup doc --book

The installation also has the full documentation for the version you are using.
Access it via:

rustup doc

-1010

Sad but true:

rust has 2 types of literals for ranges one is with 2 dots other with 3 dots.

1. for i in 1..10 {
// open ended range
// 1 is included but not 10
println!("{}", i);
} // in this form if you want closed end range use '..='

2. let x = match { // only closed end range but different syntax
1...10 => x, // inclusive 1 & 10
_ => 0
}

Usage of these range literals are NOT interchangeable!

-1013

rust installation includes rustup command.
rustup has many uses, it is basically the environment control command.

Using rustup you can see which components are installed on your machine.

rustup show
will display currently installed tool-chains and which one is the active one.

rustup componet add rust-src
will install the full rust language and standard library source for your current tool-chain.

-1004

Rust uses structs , tuples and enumerations
to offer composite data-types beyond the basic data-types.
Structs are similar to c++ structs,
tuples are similar to python tuples,
enumerations are more advanced than c++ enum class as they
can contain parameters and pair up smartly with a matching
construct to process enumeration driven differences.

-1004

Rust uses structs , tuples and enumerations
to offer composite data-types beyond the basic data-types.
Structs are similar to c++ structs,
tuples are similar to python tuples,
enumerations are more advanced than c++ enum class as they
can contain parameters and pair up smartly with a matching
construct to process enumeration driven differences.

-1003

To install rust, run:

`curl sh.rustup.rs -sSf | sh`

and append to your .bashrc (or .profile)

export PATH="$HOME/.cargo/bin:$PATH"

-1004

Rust uses structs , tuples and enumerations
to offer composite data-types beyond the basic data-types.
Structs are similar to c++ structs,
tuples are similar to python tuples,
enumerations are more advanced than c++ enum class as they
can contain parameters and pair up smartly with a matching
construct to process enumeration driven differences.

------------------
rust installation comes with a whole programming book.
To access the html version of the book in your local environment just type:

rustup doc --book

The installation also has the full documentation for the version you are using.
Access it via:

rustup doc

-----------------------
Please reply to report error rust:1005

------------------
Out of the box rust addresses different environment/version options.
Using `rustup default nightly` command you can switch between stable/beta/nightly builds of the rust tool-chain.

-----------------------
Please reply to report error rust:1002

------------------
Rust installation comes with code documentation generator which facilitates documentation tasks by incorporating special comments in code to be used as documentation.

/// this is for documentation
// this is just a comment

/**
this also is for documentation
*/

`cargo doc` uses these to build documentation in standard format.

-----------------------
Please reply to report error rust:1001

------------------
To install rust, run:

`curl sh.rustup.rs -sSf | sh`

and append to your .bashrc (or .profile)

export PATH="$HOME/.cargo/bin:$PATH"

-----------------------
Please reply to report error rust:1003

------------------
Out of the box rust addresses different environment/version options.
Using `rustup default nightly` command you can switch between stable/beta/nightly builds of the rust tool-chain.

-----------------------
Please reply to report error rust:1002

------------------
Out of the box rust addresses different environment/version options.
Using `rustup default nightly` command you can switch between stable/beta/nightly builds of the rust tool-chain.

-----------------------
Please reply to report error rust:1002

------------------
Rust has the following built-in simple data types:
i8, i16, i32, i64 (integers)
u8, u16, u32, u64 (unsigned integers)
isize, usize, (pointer size integer/unsigned)
f32, f64 (floating point)
char (a unicode character)
bool (true/false)

-----------------------
Please reply to report error rust:1000

Show more
Mastodon

Follow friends and discover new ones. Publish anything you want: links, pictures, text, video. This server is run by the main developers of the Mastodon project. Everyone is welcome as long as you follow our code of conduct!