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