Looking at both the docs and the code, it appears that str
is a primitive type, while String
is a struct { Vec<u8> }
. Now as str
is to a [u8]
what String
is to a Vec<u8>
, couldn't str
have been defined as
struct str { slice: [u8]; }
similar to how AsciiStr is defined? Why was/is it (still?) defined as primitive?