MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / parse_rpc_message

Function parse_rpc_message

packages/server/src/webkit.rs:1021–1038  ·  view source on GitHub ↗
(payload: &[u8])

Source from the content-addressed store, hash-verified

1019}
1020
1021fn parse_rpc_message(payload: &[u8]) -> Result<RpcMessage, AppError> {
1022 let value = Value::from_reader(Cursor::new(payload))
1023 .map_err(|error| AppError::internal(format!("Unable to parse WebKit plist: {error}")))?;
1024 let dict = value
1025 .as_dictionary()
1026 .ok_or_else(|| AppError::internal("WebKit packet was not a dictionary."))?;
1027 let selector = dict
1028 .get("__selector")
1029 .and_then(Value::as_string)
1030 .ok_or_else(|| AppError::internal("WebKit packet did not include __selector."))?
1031 .to_owned();
1032 let args = dict
1033 .get("__argument")
1034 .and_then(Value::as_dictionary)
1035 .cloned()
1036 .unwrap_or_default();
1037 Ok(RpcMessage { selector, args })
1038}
1039
1040fn parse_application_list(args: &Dictionary) -> Vec<WebKitApplication> {
1041 let Some(apps) = args

Callers 3

run_connectionMethod · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected