Add as_c_str method on strings
auto merge of #6729 : bstrie/rust/ascstr, r=Aatch

Formerly this was a free function rather than a method. I've left it in place for now, although redefined it so that it just calls the method.