Mut String += format_args!(…);

Another thread I created a while ago: Method to append any Display type to a String

I would really prefer an inherent method over a += impl, because

  • it is less magical
  • it is more general (it can be generic over Display, whereas a blanket impl<T> AddAssign<T> for String where T: Display is not possible)

In the previous discussion, there were only two open questions: The name, and whether the method should accept T or &T (though most people argued for &T).

1 Like