Following this thread, I tried to implement the From<SetCookie> for Cookie
for hyper
(reqwest
just using the hyper
implementations of the headers). I tried this and it send back this cryptic error :
error[E0277]: the trait bound
std::vec::Vec<std::borrow::Cow<'_, &str>>: std::iter::FromIterator<&str>
is not satisfied
75 | values = fi.split('=').collect::<Vec<Cow<&str>>>();
| ^^^^^^^ a collection of type `std::vec::Vec<std::borrow::Cow<'_, &str>>` cannot be built from an iterator over elements of type `&str`
|
= help: the trait `std::iter::FromIterator<&str>` is not implemented for `std::vec::Vec<std::borrow::Cow<'_, &str>>`
error[E0277]: the trait bound `std::borrow::Cow<'static, str>: _IMPL_DESERIALIZE_FOR_Config::_serde::export::From<std::borrow::Cow<'_, &str>>` is not satisfied
--> src/main.rs:76:24
|
76 | Cookie.set(values[0], values[1]);
| ^^^ the trait `_IMPL_DESERIALIZE_FOR_Config::_serde::export::From<std::borrow::Cow<'_, &str>>` is not implemented for `std::borrow::Cow<'static, str>`
|
= help: the following implementations were found:
<std::borrow::Cow<'a, [u8]> as _IMPL_DESERIALIZE_FOR_Config::_serde::export::From<url::<unnamed>::PercentDecode<'a>>>
<std::borrow::Cow<'a, str> as _IMPL_DESERIALIZE_FOR_Config::_serde::export::From<url::<unnamed>::PercentEncode<'a, E>>>
<std::borrow::Cow<'a, str> as _IMPL_DESERIALIZE_FOR_Config::_serde::export::From<std::string::String>>
<std::borrow::Cow<'a, str> as _IMPL_DESERIALIZE_FOR_Config::_serde::export::From<&'a str>>
and 5 others
= note: required because of the requirements on the impl of `_IMPL_DESERIALIZE_FOR_Config::_serde::export::Into<std::borrow::Cow<'static, str>>` for `std::borrow::Cow<'_, &str>`
Why is doing that ? How could I fix that ?
Bonus question : How could I "rustify" the code (i.e. putting iterator everywhere ? ) ?