MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / attach_tree_metadata

Function attach_tree_metadata

packages/server/src/api/routes.rs:4936–4962  ·  view source on GitHub ↗
(
    mut snapshot: Value,
    available_sources: &[String],
    fallback_reason: Option<String>,
)

Source from the content-addressed store, hash-verified

4934}
4935
4936fn attach_tree_metadata(
4937 mut snapshot: Value,
4938 available_sources: &[String],
4939 fallback_reason: Option<String>,
4940) -> Value {
4941 if let Value::Object(ref mut object) = snapshot {
4942 object.insert(
4943 "availableSources".to_owned(),
4944 Value::Array(
4945 available_sources
4946 .iter()
4947 .map(|source| Value::String(source.clone()))
4948 .collect(),
4949 ),
4950 );
4951 if let Some(reason) = fallback_reason {
4952 object.insert("fallbackReason".to_owned(), Value::String(reason));
4953 if object.get("source").and_then(Value::as_str) == Some(SOURCE_NATIVE_AX) {
4954 object.insert(
4955 "fallbackSource".to_owned(),
4956 Value::String(SOURCE_NATIVE_AX.to_owned()),
4957 );
4958 }
4959 }
4960 }
4961 snapshot
4962}
4963
4964fn inspector_metadata(
4965 info: &Value,

Calls 3

insertMethod · 0.80
cloneMethod · 0.65
getMethod · 0.65