expect_json/expects/
expect_magic_id.rs

1use serde::Deserialize;
2use serde::Serialize;
3use serde_json::Value;
4
5#[derive(Default, Copy, Clone, Debug, Serialize, Deserialize)]
6pub enum ExpectMagicId {
7    /// This is an ID to uniquely identify the Expect Json objects over anything else.
8    ///
9    /// The ID contains a UUID which I generated on my machine.
10    /// It doesn't matter what that value is, or if it's known by others.
11    /// All that matters is it is unique enough that it is impossible to
12    /// clash with other code by accident.
13    #[allow(non_camel_case_types)]
14    #[default]
15    __ExpectJson_MagicId_0ABDBD14_93D1_4D73_8E26_0177D8A280A4__,
16}
17
18impl ExpectMagicId {
19    pub fn is_magic_id_value(value: &Value) -> bool {
20        value
21            .as_str()
22            .map(|value_str| {
23                value_str == "__ExpectJson_MagicId_0ABDBD14_93D1_4D73_8E26_0177D8A280A4__"
24            })
25            .unwrap_or_default()
26    }
27}