mirror of
https://github.com/google/comprehensive-rust.git
synced 2024-12-15 06:20:32 +02:00
Use std::string_view
(not just const char*
) as an analogy of &str
. (#1518)
This commit is contained in:
parent
f837afa034
commit
9d21d5648d
@ -48,7 +48,7 @@ Rust terminology:
|
||||
boundaries, the expression will panic. The `chars` iterator iterates over
|
||||
characters and is preferred over trying to get character boundaries right.
|
||||
|
||||
* For C++ programmers: think of `&str` as `const char*` from C++, but the one that always points
|
||||
* For C++ programmers: think of `&str` as `std::string_view` from C++, but the one that always points
|
||||
to a valid string in memory. Rust `String` is a rough equivalent of `std::string` from C++
|
||||
(main difference: it can only contain UTF-8 encoded bytes and will never use a small-string optimization).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user