Skip to main content

parse_registry_data

Function parse_registry_data 

Source
pub fn parse_registry_data(bytes: &[u8]) -> Result<Value, ServiceError>
Expand description

Parse raw .ron bytes into a Value tree.

Uses RON’s dynamic value type internally, which handles both named structs (ItemDef(id: 1)) and anonymous data ({ "id": 1 }).

Single point of parsing: today .ron, tomorrow maybe .json or .bin. Plugins do not change code — just recompile with a newer plugin-api version.

§Examples

use openstranded_plugin_api::parse_registry_data;

// Named struct (common in .ron data files)
let bytes = b"[ItemDef(id: 1, name: \"Wood\")]";
let data = parse_registry_data(bytes).unwrap();