MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / select

Method select

crates/client-api/src/util/websocket.rs:40–51  ·  view source on GitHub ↗
(&self, protocols: impl IntoIterator<Item = (S, P)>)

Source from the content-addressed store, hash-verified

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
54pub struct ResponseSecWebsocketProtocol(pub HeaderValue);

Callers 15

getUserRoomsFunction · 0.45
processScheduledMessagesFunction · 0.45
processExpiredMessagesFunction · 0.45
cleanupTypingIndicatorsFunction · 0.45
index.tsFile · 0.45
checkRateLimitFunction · 0.45
index.tsFile · 0.45
index.tsFile · 0.45
index.tsFile · 0.45
startJobsFunction · 0.45
index.tsFile · 0.45
mainFunction · 0.45

Calls 7

try_intoMethod · 0.80
iterMethod · 0.65
mapMethod · 0.45
findMethod · 0.45
into_iterMethod · 0.45
anyMethod · 0.45

Tested by

no test coverage detected