Skip to main content

encode_with_indent

Function encode_with_indent 

Source
pub fn encode_with_indent(value: &LinoValue, indent: &str) -> String
Expand description

Encode a value to the readable format using a custom indentation string.

§Arguments

  • value - The value to encode
  • indent - The indentation string used per nesting level

§Example

use lino_objects_codec::{encode_with_indent, LinoValue};

let data = LinoValue::object([("age", LinoValue::Int(30))]);
assert_eq!(encode_with_indent(&data, "    "), "(\n    age 30\n)");