r[type.str]
r[type.str.intro] The string slice (str) type represents a sequence of characters.
let greeting1: &str = "Hello, world!"; let greeting2: &str = "你好,世界";
[!NOTE] See [the standard library docs][
str] for information on the impls of thestrtype.
r[type.str.value] A value of type str is represented in the same way as [u8], a slice of 8-bit unsigned bytes.
[!NOTE] The standard library makes extra assumptions about
str: methods working onstrassume and ensure that the data it contains is valid UTF-8. Calling astrmethod with a non-UTF-8 buffer can cause undefined behavior now or in the future.
r[type.str.unsized] A str is a dynamically sized type. It can only be instantiated through a pointer type, such as &str. The layout of &str is the same as the layout of &[u8].