MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / serialize_sandbox_policy

Function serialize_sandbox_policy

crates/openshell-policy/src/lib.rs:972–977  ·  view source on GitHub ↗

Serialize a proto sandbox policy to a YAML string. This is the inverse of [`parse_sandbox_policy`] — the output uses the canonical YAML field names (e.g. `filesystem_policy`, not `filesystem`) and is round-trippable through `parse_sandbox_policy`.

(policy: &SandboxPolicy)

Source from the content-addressed store, hash-verified

970/// canonical YAML field names (e.g. `filesystem_policy`, not `filesystem`)
971/// and is round-trippable through `parse_sandbox_policy`.
972pub fn serialize_sandbox_policy(policy: &SandboxPolicy) -> Result<String> {
973 let yaml_repr = from_proto(policy);
974 serde_yml::to_string(&yaml_repr)
975 .into_diagnostic()
976 .wrap_err("failed to serialize policy to YAML")
977}
978
979/// Convert a proto sandbox policy into the canonical policy JSON representation.
980///

Calls 1

from_protoFunction · 0.85