-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify how or make it easier to pass in collections that are T: Iterator<Item=D> in builder functions for helix requests #374
Comments
We could clarify in the documentation for the methods how to do this, or make new methods that take I think I prefer the second alternative, since one would have to do an allocation either way if you have a @laundmo also mentions in the discord thread a solution that would involve a |
heres my CollectionRef idea: a great advantage is that this works on many collections and even individual items |
This could also be applied for the client ext methods which currently takes |
also experimented with fn into_slice_cow(self) -> std::borrow::Cow<'a, [R]>
where
[R]: ToOwned,
R: Sized + 'a, {
match self {
std::borrow::Cow::Borrowed(b) => {
std::borrow::Cow::Borrowed(std::slice::from_ref(b.into()))
}
std::borrow::Cow::Owned(o) => {
let a: std::borrow::Cow<'_, R> = std::borrow::Cow::Owned(o.into());
let a = std::slice::from_ref(a.as_ref());
std::borrow::Cow::Borrowed(a) // ~ cannot return value referencing local variable `a`
}
}
} |
improved with #359 |
This came up in discussion over at Twitch API Discord
currently, it can be hard to reason how to deal with a method like
we have a bunch of these after #280
One way to deal with this, given we have a
Vec<String>
, isbut coming up with this is not apparent.
This is related to #114 (comment) where we would make the allocation optional
The text was updated successfully, but these errors were encountered: