let mut x = "Deez";
x = "nuts";
&str
is just a view, String
is like a buffer that you can write to&str
view of String
std::unique_ptr
with extra stepsstd::string_view
? &mut str
isn't a slice as far as the language is concerned[T]
. Contiguous here means that elements are laid out so that every element is the same distance from its neighbors.&mut str
to &mut [u8]
would be unsound btwsorted
is just like in pythonIterator
] blanket implementation that provides extra adaptors and methods.&mut str
&mut str
, I think&mut String
or a String
&mut str
, I think &mut str
in my (checks calendar) ~10 years of rustfn main() {
let mut hello = String::new();
hello.push_str("hello");
println!("{hello}")
}
&str
is useful, &mut str
is not