3 ms·
And I expect virtually all of the methods on slice to be available on String before long. I think it's a bug that this isn't the case today. It's already possi
by wycats 12y ago
And I expect virtually all of the methods on slice to be available on String before long. I think it's a bug that this isn't the case today.
It's already possible to have a function take "either a String or slice" generically:
def print_me<T>(me: T) where T: Str {
println!("I am '{:s}'", me.as_slice());
}
The overall ergonomics of this (or at least, the well-documented idioms) will certainly improve in the coming months.