Rust Tutorial #4 - Data Types

preview_player
Показать описание
This is the fourth video in this Rust programming tutorial series! In this video I will be going over data types, specifically the primitive data types in Rust. Now, there is a lot more data types to cover and I will go over those in later videos. For now, we are just going to look at the most basic ones which are primitive. Enjoy the video!

⭐️ Timestamps ⭐️
00:00 | Introduction
00:50 | Primitive, Scalar and Compound
01:42 | Integers
05:35 | Floating-Points
06:28 | Booleans
07:06 | Characters
08:26 | Tuples
12:47 | Arrays

◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️

◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️

⭐️ Tags ⭐️
-Tech With Tim
-Rust
-Rust Programming Language
-Rust Not The Game
-Learn Rust Programming
-Rust Data Types

⭐️ Hashtags ⭐️
#TechWithTim #RustProgramming
Рекомендации по теме
Комментарии
Автор

Not sure if you were ever going to mention this, but you can actually print tuples, arrays and so forth. Instead of doing println!("{}", ('h', 'i', 1, 2, 3)), which would give you an error, you can use the debug print which has the following syntax: println!("{:?}", ('h', 'i', 1, 2, 3)) or println!("{:#?}", ('h', 'i', 1, 2, 3)), the latter one giving you a neatly formatted output. Overall a nice and informative video!

jankapko
Автор

You really hit on very important details that I have not seen in tutorials when I first tried Rust 5 months ago. Thanks!

mbrav
Автор

You actually CAN convert some int types, like in the case at the end of the video, this will work:
let x: u8 = 4;
let y: i32 = x as i32;

OR

let y: i32 = x.into();

Hope it helps

interclosure
Автор

Wow this tutorial series is very useful since i'm looking for a low level language to learn

earlchesterantonio
Автор

PET THE DAMN CAT xD Nice Video btw even tho it isnt my first language but I really appreciate it how you try to explain everything ( like types etc)

Lu-Die-MilchQ
Автор

At 4:28, I would like to provide a clarification. The accurate formula for determining the range is -(2^(n - 1)) to (2^(n - 1)) - 1. As a result, the range for the signed 8-bit integer (i8) would be -128 to 127.

shirazbabar
Автор

Tim, I think you are confusing bool types in rust with other languages. A non-zero int does not mean true. In fact, if you attempted to declare 0 or 1 as a bool var as you did in your example, you'd get a compiler error: "expected 'bool', found integer".

nickheyer
Автор

the range of signed integers is implementation defined for compiled languages.

dmasterify
Автор

Very important for arrays:
the type usize was not discussed.
It is "basically a u32 or u64"***
variables with this type are unsigned integers, but have a bit-length which can vary based on the system it is compiled on.
More specifically, they are unsigned integers of bit-length equal to ( the bit-length of a pointer at compile time ).
usize is important to discuss early because it is the expected data type for the index argument of an array.
Example:
fn main()
{
let array_name: [u32; 3] = [0, 1, 2];
let index: usize = 2;
let output: u32 = array_name[index];
println!("{}", output);
}

oneilmw
Автор

If i have a tupple with type (i32, bool, char) then does rhe sequence matter

mortaldev
Автор

hey Tim. can Rust replace C and C++ in the future? currently what kind of jobs use Rust?

mukund
Автор

We need next how to convert between then easly, like string to i32, &str to String ; just something like that

hamdysaadpersonal
Автор

11:41 mm no warning despite u never read that tup before modifying it... That's one implicit promise of the debugger broken there ^^

alienews
Автор

How are you getting autocomplete feature?

madhuvarun
Автор

I'd imagine "tuple" should actually be pronounced similarly to "to pull", according to English spelling rules. Because there is only a single "p", and the "u" is not the second last letter, the vowel makes a long sound, not short, and because there is a silent "e" at the end, the sound the vowel makes shifts, roughly from the sound it would make in a word like "up", to the sound it would make in a word like "mute".

HughvanZyl
Автор

This has nothing to do with Rust but I have to know: why does his start menu open every time he switch from his editor to an already opened console?

SlyPearTree
Автор

Good video, but I don't understand why you left out strings. Coming from a Python background the difference between String objects and string literals in Rust was very unintuitive to me.

introspecticon
Автор

8:23 as a German we spell tupel with a long u

albatroshd
Автор

Does Python have an interface for Rust or vice-versa ?

johnnytoobad
Автор

Is the reason i8 range is -128 to 127 instead of -255 to 255 because the minus sign is taking a bit?

ryanbohling
visit shbcf.ru