Expand description
YAML_lib - A lightweight, modular YAML toolkit for Rust
This library provides a flexible YAML implementation with:
- Core Node type for representing YAML structures
- Parser to build Node trees from streams
- Multiple format serializers (YAML, YAML, XML, Bencode)
- File and buffer I/O abstractions
- Pretty-printing utilities
- Unicode-aware file handling
Minimum supported Rust version: 1.88.0
Structs§
- Buffer
Destination - Destination implementation for writing JSON data to a memory buffer A memory buffer implementation for storing encoded JSON data as bytes. Provides functionality to write and manipulate byte content in memory.
- Buffer
Source - Source implementation for reading JSON data from a memory buffer A memory buffer implementation for reading JSON data from bytes. Provides functionality to traverse and read byte content from memory.
- File
Destination - Destination implementation for writing JSON data to a file A file-based destination for writing JSON data to disk. Implements file operations for storing and manipulating encoded data.
- File
Source - Source implementation for reading JSON data from a file File
Enums§
- Format
- ============ YAML_lib API
- Node
- Core data structure representing a JSON node and numerical node in the parsed tree A node in the YAML data structure that can represent different types of values. Node
- Numeric
- Core data structure representing a numeric value node in the parsed tree Represents different numeric types that can be stored in a YAML node Numeric
Functions§
- detect_
format - This function detects the Unicode format of a text file by examining its byte order mark (BOM) Detects the Unicode format of a text file by examining its byte order mark (BOM).
- get_
document - Returns the base node of document number n (0-based), reporting any errors. Returns the base node of document number n (0-based), reporting any errors. If the node is not a Document or the index is out of bounds, returns an error message.
- get_
number_ of_ documents - Returns the number of documents in a YAML stream represented by the Documents node. Returns the number of documents in a YAML stream represented by the Documents node. If the node is not a Documents node, returns an error message.
- make_
node - Helper function to create a Node from any value that can be converted into a Node Helper functions to create a Node from any value that can be converted into a Node
- make_
set - Helper function to create a Set node from a vector, ensuring uniqueness Helper function to create a Set node from a vector, ensuring uniqueness
- parse
- Parses json data into a Node tree structure Main entry point for parsing YAML content from a source.
- read_
file_ to_ string - This function reads a text file and returns its content as a String, handling different Unicode formats Reads a text file and returns its content as a String, handling different Unicode formats Reads a text file and returns its content as a UTF-8 string.
- stringify
- Converts a Node tree back to YAML format Main entry point for stringifying YAML nodes to their text representation.
- to_
bencode - Converts a Node tree to bencode format Converts YAML nodes to Bencode format.
- to_json
- Converts a Node tree to JSON format stringify Converts YAML nodes to compact JSON format.
- to_
json_ pretty - Converts YAML nodes to pretty-printed JSON format with indentation.
- to_toml
- Converts a Node tree to TOML format stringify
- to_
toml_ pretty - Pretty variant currently delegates to the same behaviour (TOML key/value layout is line-oriented).
- to_xml
- Converts a Node tree to XML format stringify
- to_
xml_ pretty - Pretty-print XML (delegates to same behaviour for now)
- version
- Returns the current version of the YAML library Returns the current version of the package as specified in Cargo.toml. Uses CARGO_PKG_VERSION environment variable that is set during compilation from the version field in Cargo.toml.
- write_
file_ from_ string - This function writes a string to a file in the specified Unicode format Writes a string to a file in the specified Unicode format Writes string content to a file with the specified Unicode format and BOM.