Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

mneumann/rust-toml

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

⚠️ WARNING: This is no longer maintained nor works with current versions of Rust! Please use toml-rs instead.

rust-toml Build Status

A TOML configuration file parser for Rust.

Quickstart

Given the following TOML configuration file:

# products.toml
[global]

# ...

[db]

  [[db.products]]

  id = 1
  name = "prod1"

  [[db.products]]

  id = 2
  name = "prod2"

You can access it like in the example below:

extern crate toml = "github.com/mneumann/rust-toml#toml:0.1";

fn main() {
    let root = toml::parse_from_file("products.toml").unwrap();
    let id1  = root.lookup("db.products.0.id").get_int();
    let name2 = root.lookup("db.products.1.name").get_str();
    match (id1, name2) {
        (Some(id1), Some(ref name2)) => {
            println!("id1: {}, name2: {}", id1, name2)
        }
        _ => {
            println!("Not found")
        }
    }
}

Benchmark

I did a pretty non-scientific benchmark against go-toml for a very large document (3 million lines). Not that it would matter in any way, but it shows that rust-toml is about three times as fast.

Conformity

I am using this test suite to check for conformity to the TOML spec. The test cases are also included in this git repo, you can run them with this command:

./bin/testsuite ./tests

Alternatively you can run it with the test runner from the original test-suite using this command (see it's homepage for details on how to install it):

$HOME/go/local/bin/toml-test rust-toml/bin/testsuite

Right now all 63 tests pass, none fails.

License

rust-toml is under the MIT license, see LICENSE-MIT for details.

Copyright (c) 2014 by Michael Neumann.

About

[DEPRECATED] A TOML configuration file parser for Rust

Resources

License

Stars

Watchers

Forks

Packages

No packages published