pub struct ObjectCodec { /* private fields */ }Expand description
Codec for encoding/decoding LinoValue to/from Links Notation.
This codec handles the conversion between LinoValue and Links Notation
format strings. It supports circular references and shared object identity
through object ID references.
Implementations§
Source§impl ObjectCodec
impl ObjectCodec
Sourcepub fn encode(&mut self, value: &LinoValue) -> String
pub fn encode(&mut self, value: &LinoValue) -> String
Encode a LinoValue to the readable, indented Links Notation format.
This is the default representation: keys and values are written as plain
text, one per line, so the result can be read and reviewed directly.
See readable for the exact shape.
§Arguments
value- The value to encode
§Returns
A string in readable Links Notation format
Sourcepub fn encode_with_indent(&mut self, value: &LinoValue, indent: &str) -> String
pub fn encode_with_indent(&mut self, value: &LinoValue, indent: &str) -> String
Encode a LinoValue to the readable format using a custom indentation string.
§Arguments
value- The value to encodeindent- The indentation string used per nesting level (for example" ")
Sourcepub fn encode_compact(&mut self, value: &LinoValue) -> String
pub fn encode_compact(&mut self, value: &LinoValue) -> String
Encode a LinoValue to the compact, single-line Links Notation format.
Every value is tagged with its type and every string is base64-encoded, so the whole document fits on one line and carries no readable text. This was the default before the readable format; callers now opt into it explicitly.
§Arguments
value- The value to encode
§Returns
A string in compact Links Notation format
Sourcepub fn encode_obfuscated(&mut self, value: &LinoValue) -> String
pub fn encode_obfuscated(&mut self, value: &LinoValue) -> String
Encode a LinoValue to the compact, base64 form.
Alias of ObjectCodec::encode_compact, named after what the form does to
its content: nothing in the output can be read without decoding it.