Is there a crate for adding "consuming" versions of String methods?

53 points NormalAppearance2851 17 comments

This would make programming infinitely easier and better for me.

For example:

.truncate()

let mut string = String::from("abcde");
string.truncate(3);
string //abc

.truncated()

let string = String::from("abcde").truncated(3); // Simple as that, no need for making it mutable either.

The itertools crate has a .sorted(), a "consuming" version of .sort(). Do we have a "stringtools" crate 😂