Skip to content

Clarify how or make it easier to pass in collections that are T: Iterator<Item=D> in builder functions for helix requests #374

@Emilgardis

Description

@Emilgardis

This came up in discussion over at Twitch API Discord

currently, it can be hard to reason how to deal with a method like

fn(Self, impl Into<Cow<'a, [&'a Borrowed]>>)

we have a bunch of these after #280

One way to deal with this, given we have a Vec<String>, is

fn builder(s: impl Into<Cow<'a, [&'a Borrowed]>>) -> Foo {
    todo!()
}

fn bar(items: Vec<String>) {
    let items: Vec<&Borrowed> = items.iter().map(Into::into).collect();
    builder(items)
}

but coming up with this is not apparent.

This is related to #114 (comment) where we would make the allocation optional

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions