You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, these work (they both return "foo foo foo", as you'd expect):
["foo";3].connect(" ")vec!["foo";3].connect(" ")
But these do not:
// type `collections::linked_list::LinkedList<&str>` does not implement any method in scope named `connect`LinkedList::from_iter(repeat("foo").take(3)).connect(" ")// type `core::iter::Take<core::iter::Repeat<&str>>` does not implement any method in scope named `connect`
repeat("foo").take(3).connect(" ")
I think coherence should allow it. Note that the slice versions iterate twice, to calculate the needed allocation exactly before concat. The iterator version can't do that, so it will be less efficient that way.
Note that the slice versions iterate twice, to calculate the needed allocation exactly before concat. The iterator version can't do that, so it will be less efficient that way.
This got me thinking: if the ability to iterate twice is sufficient, could the methods be bounded on Self: Clone? This should preserve the efficiency while relaxing the requirements.
Currently, these work (they both return
"foo foo foo"
, as you'd expect):But these do not:
Might
std::slice::SliceConcatExt
, be implemented for collections of and iterators over&str
s?The text was updated successfully, but these errors were encountered: