decode_schema

Function decode_schema 

Source
pub fn decode_schema(encoded: &str, pretty: bool) -> Result<String, SchemaError>
Expand description

Decode schema format to JSON: framed → display96 → [decompress] → binary → IR → JSON

Reverses the schema encoding pipeline to reconstruct the original JSON from the framed, display-safe wire format. Automatically detects and handles compression.

§Arguments

  • encoded - Schema-encoded string with delimiters (𓍹...𓍺)
  • pretty - Pretty-print JSON output with indentation

§Returns

Returns the decoded JSON string (minified or pretty-printed)

§Errors

  • SchemaError::InvalidFrame - Missing or invalid frame delimiters
  • SchemaError::InvalidCharacter - Invalid character in display96 payload
  • SchemaError::Decompression - Decompression failure
  • SchemaError::UnexpectedEndOfData - Truncated or corrupted binary data
  • SchemaError::InvalidTypeTag - Invalid type tag in header

§Example

use base_d::decode_schema;

let encoded = "𓍹╣◟╥◕◝▰◣◥▟╺▖◘▰◝▤◀╧𓍺";

// Minified output
let json = decode_schema(encoded, false)?;
println!("{}", json); // {"users":[{"id":1,"name":"alice"}]}

// Pretty-printed output
let pretty = decode_schema(encoded, true)?;
println!("{}", pretty);
// {
//   "users": [
//     {"id": 1, "name": "alice"}
//   ]
// }

§See Also