The Rust Programming Language
The Rust Programming Language

The Rust Programming Language — Collections — Memory

Ankit Tanna
3 min readOct 12, 2023

--

Memory in computer science is nothing but series of bits. A bit is nothing but a flag 1 or 0. The smallest series of bits is known as byte which is continuous series of 8 bits. A memory in your computer is a big long bunch of 0 and 1.

But, standalone, 0 and 1 are not that useful. We are talking about how do we make meaning out of strings and numbers that we store in the memory. How do we make sense of 0 and 1 from the long series of bits in the memory?

Bytes interpretation from bits
Bytes interpretation from bits

The program that we are running is interpreting the bits in group of 8 (aka byte). So we have Byte 1 which is 11110011 and Byte 2 as 01101011. Byte is the smallest unit which is 8 bits series.

11110011 translates to 243 in binary.
01101011 translates to 107 in binary.

Interpretation of bytes to a value
Interpretation of bytes to a value

We won’t go into details of how binary is translated to numbers, but you can try it here and read the formula. Important part is we chose to interpret this memory in different ways in order to get more useful…

--

--