From 25455d4f2fb4085881d3b7343df2e963b427b045 Mon Sep 17 00:00:00 2001 From: Mahdi Dibaiee Date: Fri, 17 Jun 2022 15:56:44 +0100 Subject: [PATCH] Vec instead of Vec --- _posts/2022-06-16-rust-boxed-str-vs-string.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/2022-06-16-rust-boxed-str-vs-string.md b/_posts/2022-06-16-rust-boxed-str-vs-string.md index 1f039cc..8be150b 100644 --- a/_posts/2022-06-16-rust-boxed-str-vs-string.md +++ b/_posts/2022-06-16-rust-boxed-str-vs-string.md @@ -13,7 +13,7 @@ Today I and a friend went down a rabbit hole about Rust and how it manages the h TL;DR: -`Box` is a fixed-size primitive `str` allocated on the heap, whereas `String` is actually a `Vec`, also allocated on the heap, which allows for efficient removals and appendages. `Box` (16 bytes) uses less memory than `String` (24 bytes). +`Box` is a fixed-size primitive `str` allocated on the heap, whereas `String` is actually a `Vec`, also allocated on the heap, which allows for efficient removals and appendages. `Box` (16 bytes) uses less memory than `String` (24 bytes). ------ @@ -176,7 +176,7 @@ Process 68317 stopped } ``` -This is a formatted output from `lldb`, and here you can see that the `String` type is basically a `Vec`, let's now look at the same command but this time raw and unformatted (`-R`): +This is a formatted output from `lldb`, and here you can see that the `String` type is basically a `Vec` (note that `unsigned char` is represented using `u8` in Rust, so in Rust terminology the type is `Vec`), let's now look at the same command but this time raw and unformatted (`-R`): ``` (lldb) frame var -L -T -R