title: How to accept &str, String and &String in a single function?
body: <p>I want to write a single function, that accepts a <code>&amp;str</code>, a <code>String</code> and a borrowed <code>&amp;String</code>. I've written the following 2 functions:</p>
  
  <pre><code>fn accept_str_and_ref_string(value: &amp;str) {
      println!("value: {}", value);
  }
  
  fn accept_str_and_string&lt;S: Into&lt;String&gt;&gt;(value: S) {
      let string_value: String = value.into();
      println!("string_value: {}", string_value);
  }
  
  fn main() {
      let str_foo = "foo";
      let string_foo = String::from("foo");
  
      accept_str_and_ref_string(str_foo);
      accept_str_and_ref_string(&amp;string_foo);
  
      accept_str_and_string(str_foo);
      accept_str_and_string(string_foo);
  }
  </code></pre>
  
  <p>Is it possible to implement one function so that I can do this:</p>
  
  <pre><code>accept_all_strings(str_foo);
  accept_all_strings(&amp;string_foo);
  accept_all_strings(string_foo);
  </code></pre>