packages

toml

0.1.0공식

TOML 1.1.0: Value tree with typed datetimes, parser with line:col errors, writer, typed encode/decode

공개 · MIT OR Apache-2.0 · 의존성 0개

공식 패키지: use toml::..;만 쓰면 첫 빌드가 추가합니다. 또는:

nabi add toml

그다음 코드에서

use toml::Value;
deps: {
    "toml": Dep::version("^0.1.0"),
},

CI packages.nabi-lang.org License: MIT OR Apache-2.0

TOML 1.1.0 for Nabi: a Value tree with typed date-times, a parser with line:col errors, a writer that lays documents out as people write them, and typed conversion with #[derive(Toml)]. The API follows std's nabion module: parse / to_str / from_str / to_value / from_value, with ToToml / FromToml traits.

Add it

nabi add toml

Needs Nabi 0.1 or later.

Usage

let doc = try toml::parse("title = \"demo\"\n\n[owner]\nname = \"Tom\"\n");
let owner = doc.get("owner") ?? toml::Value::Bool(false);
println(owner.get("name")?.as_str() ?? "");   // Tom
println(doc.to_str());                         // the document again

Derive Toml on your own types for typed from_str / to_str. parse reads TOML 1.1.0 by default; pass Version::V1_0 to read strictly as 1.0.

Docs

https://packages.nabi-lang.org/packages/toml/latest/docs

License

Licensed under either of MIT or Apache-2.0, at your option. The files under tests/ are from toml-test, MIT License, Copyright (c) 2018 TOML authors.

README 출처: github.com/nabi-lang/toml, 커밋 d79507b7.