Brinker: String Types in Rust
Andrew Brinker looksat string types in Rust."Another important thing to note is that because the "owned" sorts of strings abstract away the underlying buffer, they can grow or shrink, possibly allocating a new underlying buffer and copying their contents to this new buffer. The "slice" sorts of strings cannot be resized, as they may not even be on the heap.The "slice" sort strings can only be accessed via what's called a "fat pointer." This is because slices are "dynamically-sized types," meaning they do not carry information about their own length. They are simply some collection of contiguous memory. A "fat pointer" to a slice stores both a pointer to the memory in question and the length of the data stored at that memory location. This is all handled automatically by Rust, but it means that the "slice" sort of strings are interacted with via references, rather than being handled directly."