I'm building a wrapper for somebody else's generic API, whose FromEncoding trait supports most primitive types[1] (#footnote-682731-1). I want this wrapper to support gathering the values supplied by that API together into a collection.
Initially I thought, "collections implement FromIterator<Element>, couldn't that handle it?" Apparently not, since Rust (quite reasonably) can't determine which Element I mean: several impl FromEncoding for IterElement could each match an impl FromIterator<IterElement> for Bucket<BucketElement>. Is there a way around this, or should I just support a fixed selection of collections (say Vec and HashSet)?
The actual trait here is rusqlite::FromSql, if that helps rule out an XY problem. ↩︎ (#footnote-ref-682731-1)