Crate toml [−] [src]
A TOML-parsing library
This library is an implementation in Rust of a parser for TOML configuration files 1. It is focused around high quality errors including specific spans and detailed error messages when things go wrong.
This implementation currently passes the language agnostic test suite.
Example
let toml = r#" [test] foo = "bar" "#; let value = toml::Parser::new(toml).parse().unwrap(); println!("{:?}", value);
Conversions
This library also supports using the standard Encodable
and Decodable
traits with TOML values. This library provides the following conversion
capabilities:
String
=>toml::Value
- viaParser
toml::Value
=>String
- viaDisplay
toml::Value
=> rust object - viaDecoder
- rust object =>
toml::Value
- viaEncoder
Convenience functions for performing multiple conversions at a time are also provided.
Structs
DecodeError |
Description for errors which can occur while decoding a type. |
Decoder |
A structure to transform TOML values into Rust values. |
Encoder |
A structure to transform Rust values into TOML values. |
Parser |
Parser for converting a string to a TOML |
ParserError |
A structure representing a parse error. |
Enums
DecodeErrorKind |
Enumeration of possible errors which can occur while decoding a structure. |
Error |
Enumeration of errors which can occur while encoding a rust value into a TOML value. |
Value |
Representation of a TOML value. |
Functions
decode |
Decodes a TOML value into a decodable type. |
decode_str |
Decodes a string into a toml-encoded value. |
encode |
Encodes an encodable value into a TOML value. |
encode_str |
Encodes an encodable value into a TOML string. |
Type Definitions
Array |
Type representing a TOML array, payload of the Value::Array variant |
Table |
Type representing a TOML table, payload of the Value::Table variant |