DEV Community

LisiurDay
LisiurDay

Posted on

Answer: What are the differences between Rust's `String` and `str`?

They are actually completely different. First off, a str is nothing but a type level thing; it can only be reasoned about at the type level because it's a so-called dynamically-sized type (DST). The size the str takes up cannot be known at compile time and depends on runtime information…

Top comments (0)