Basic Data Types in Rust
Basic data types in rust are int, float, boolean and char.
Variables in rust are type inference
Integer
Interger or int in rust is of two type signed(i) and unsigned(u).
Type declaration
Types are u8, ... u128.
Where number denotes size in bit.
Special int variables
usize and isize are type of intergers whose size is equal to the processor size.
Decimals
By default all floats are signed and 64 bit there is also f32.
let balance: f32 = 10.1;
Character
In rust a char is of 4 bytes and is used with single quotes.
let ans: char = 'Y';
Boolean
Boolean uses 1 byte in rust.
let isEven: bool = true;
Note: these data types has methods in it.
let square = i32::pow(10, 2);