Skip to main content

Mountain/IPC/UriComponents/
StampMidUri.rs

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