如何在文档中找到 to_string 可用于 &str?

How to find in documentation that to_string is available for &str?

我试图了解 , but I couldn't find that there is a method to_string in the documentation for str 时发生了什么,即使我知道它在那里。

在文档中 &str and ToString::to_string 之间没有直接的 link 因为 ToString 有一个 全面实施:

impl<T> ToString for T where T: Display, T: ?Sized

这意味着 ToString 为任何实现 Display 的项目实现。 &str 确实实现了 Display.

(从 a comment 移动)。