Rust data type


Release date:2023-11-07 Update date:2023-11-07 Editor:admin View counts:187

Label:

Rust data type

There are several basic data types in the Rust language.

Integer type

Integer type is referred to as integer type, which can be divided into the following categories according to bit length and sign or not:

Bit length

Signed

Unsigned

8-bit

I8

U8

16-bit

I16

U16

32-bit

I32

U32

64-bit

I64

U64

128-bit

I128

U128

Arch

Isize

Usize

Two types of integers isize and usize are used to measure data size, and their bit length depends on the target platform on which they are running, and processors with 32-bit architecture will use 32-bit length integers.

Integers are expressed in the following ways:

Binary system

Example

Decimal system

98_222

hexadecimal

0xff

Octal system

0o77

Binary system

0b1111_0000

Bytes (can only represent type U8)

Baked A’

Powered by TorCMS (https://github.com/bukun/TorCMS).