Skip to main content

Crate facet_toml

Crate facet_toml 

Source
Expand description

TOML serialization for facet using the new format architecture.

This is the successor to facet-toml, using the unified facet-format traits.

§Deserialization

use facet::Facet;
use facet_toml::from_str;

#[derive(Facet, Debug)]
struct Config {
    name: String,
    port: u16,
}

let toml = r#"
name = "my-app"
port = 8080
"#;

let config: Config = from_str(toml).unwrap();
assert_eq!(config.name, "my-app");
assert_eq!(config.port, 8080);

Structs§

SerializeOptions
Options for TOML serialization.
TomlError
Error type for TOML operations.
TomlParser
Streaming TOML parser backed by toml_parser.
TomlProbe
Probe stream for TOML.
TomlSerializeError
TomlSerializer
TOML serializer with configurable formatting options.

Enums§

DeserializeError
Error produced by the format deserializer.
TomlErrorKind
Specific error kinds for TOML operations

Functions§

from_slice
Deserialize a value from TOML bytes into an owned type.
from_slice_borrowed
Deserialize a value from TOML bytes, allowing zero-copy borrowing.
from_str
Deserialize a value from a TOML string into an owned type.
from_str_borrowed
Deserialize a value from a TOML string, allowing zero-copy borrowing.
to_string
Serialize a value to a TOML string
to_string_with_options
Serialize a value to a TOML string with custom options.
to_vec
Serialize a value to TOML bytes