Noob question (from C++ background):
I'm quite confused with the type &str, my understanding is that str is an unsized type, and we can only interact with it by the "reference form", i.e. &str. In addition, the type &str is not really a reference/pointer (or borrow, in rust's word), but rather a "view".
std::mem::size_of::<&str>() gives 16 rather than 8 (for most borrow/ref types) as it has a pointer as well as a length stored inside.
My rant: why "&str"? Why not "str_view"? All the unique behaviors of "&str" compared to some general borrow type (e.g. "&i32") indicate that it is really not a borrow/reference, but a "view" type. The size_of==16 thing clear says that... It keeps me from seeing rationales in rust primitive types by using "&str" as the type name.
I guess the array slice/view &[T] is similar, but to keep things simple, I'll skip my rant over that.
Could you help explaining the rationales behind this? I find myself hard to get over it... I suspect it's due to some stubborn C++ mindset, but it's really hard for me to realize what exactly it is...