Add a doctest for the std::string::as_string method.

Change Example to Examples.

Add a doctest that better demonstrates the utility of as_string.

Update the doctest example to use String instead of &String.
auto merge of #19628 : jbranchaud/rust/add-string-as-string-doctest, r=steveklabnik