Skip to main content

gram_stringify_from_json

Function gram_stringify_from_json 

Source
pub fn gram_stringify_from_json(input: &str) -> Result<String, String>
Expand description

Serialize a JSON array of AstPattern objects back to gram notation.

§Arguments

  • input - JSON array string of AstPattern objects

§Returns

  • Ok(String) - Gram notation text
  • Err(String) - Serialization error message

§Examples

use gram_codec::json::gram_stringify_from_json;

let gram = gram_stringify_from_json(r#"[{"subject":{"identity":"alice","labels":["Person"],"properties":{}},"elements":[]}]"#).unwrap();
assert!(gram.contains("alice"));