(&self, protocols: impl IntoIterator<Item = (S, P)>)
| 38 | } |
| 39 | |
| 40 | pub fn select<S, P>(&self, protocols: impl IntoIterator<Item = (S, P)>) -> Option<(ResponseSecWebsocketProtocol, P)> |
| 41 | where |
| 42 | S: for<'a> PartialEq<&'a str> + TryInto<HeaderValue>, |
| 43 | { |
| 44 | protocols |
| 45 | .into_iter() |
| 46 | .find(|(protoname, _)| self.iter().any(|x| *protoname == x)) |
| 47 | .map(|(protoname, proto)| { |
| 48 | let proto_header = protoname.try_into().unwrap_or_else(|_| unreachable!()); |
| 49 | (ResponseSecWebsocketProtocol(proto_header), proto) |
| 50 | }) |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | pub struct ResponseSecWebsocketProtocol(pub HeaderValue); |
no test coverage detected