arrayvec icon indicating copy to clipboard operation
arrayvec copied to clipboard

implement FromIterator<char> for ArrayString

Open elichai opened this issue 6 years ago • 4 comments

Hi, I want to use ArrayString in rustc_hex::ToHex, this trait works on every type that implements FromIterator on Item=char. But ArrayString is Item=u8.

Is there a reason this isn't Item=char?

elichai avatar Feb 14 '19 14:02 elichai

ArrayString doesn't implement FromIterator at all. Presumably a PR adding this would be accepted.

clarfonthey avatar Jun 22 '19 19:06 clarfonthey

So it's not that easy because ArrayString and ArrayVec are inherently different. How do you think about making ArrayString just a wrapper of ArrayVec with the generic Array set to Array<Item=u8>? (just like String is a wrapper for Vec)

If so maybe i'll work on a PR

elichai avatar Jun 24 '19 21:06 elichai

@elichai That won't work so well, ArrayString should be a wrapper around "ArrayVecCopy" (not yet implemented).

bluss avatar Sep 25 '19 13:09 bluss

Closely related is core::iter::Extend<A>, which String implements for A = char | Box<str> | String | &char | &str | Cow<str>.

chris-morgan avatar Jan 05 '22 23:01 chris-morgan