Skip to main content

Mountain/IPC/UriComponents/
StampMidUri.rs

1
2//! Insert `$mid: 1` into a `UriComponents` object if it isn't already
3//! tagged. Non-object values pass through unchanged so call sites can
4//! pipe any `serde_json::Value` through without branching first.
5
6use serde_json::{Value, json};
7
8use crate::IPC::UriComponents::MID_URI;
9
10pub fn Fn(Input:Value) -> Value {
11	match Input {
12		Value::Object(mut Map) => {
13			Map.entry("$mid".to_string()).or_insert(json!(MID_URI::VALUE));
14
15			Value::Object(Map)
16		},
17
18		Other => Other,
19	}
20}