| 1 | libyaml-rust |
| 2 | ============ |
| 3 | |
| 4 | [![libyaml-rust on Travis CI][travis-image]][travis] |
| 5 | [![yaml on crates.io][crates-image]][crate] |
| 6 | |
| 7 | [travis-image]: https://travis-ci.org/kimhyunkang/libyaml-rust.svg?branch=master |
| 8 | [travis]: https://travis-ci.org/kimhyunkang/libyaml-rust |
| 9 | [crates-image]: http://meritbadge.herokuapp.com/yaml |
| 10 | [crate]: https://crates.io/crates/yaml |
| 11 | |
| 12 | [LibYAML][libyaml-home] bindings for [Rust][rust-home] |
| 13 | |
| 14 | [libyaml-home]: http://pyyaml.org/wiki/LibYAML |
| 15 | [rust-home]: http://www.rust-lang.org/ |
| 16 | |
| 17 | Dependencies |
| 18 | ------------ |
| 19 | |
| 20 | * LibYAML 0.1.4 or higher |
| 21 | * Stable Rust (2015/2018 edition) |
| 22 | |
| 23 | Usage |
| 24 | ----- |
| 25 | |
| 26 | Parse from memory |
| 27 | |
| 28 | ~~~~ {.rust} |
| 29 | extern crate yaml; |
| 30 | |
| 31 | use yaml::constructor::*; |
| 32 | |
| 33 | yaml::parse_bytes_utf8("[1, 2, 3]".as_bytes()); // => Ok(vec![YamlSequence(~[YamlInteger(1), YamlInteger(2), YamlInteger(3)])]) |
| 34 | ~~~~ |
| 35 | |
| 36 | Parse from Reader |
| 37 | |
| 38 | ~~~~ {.rust} |
| 39 | extern crate yaml; |
| 40 | |
| 41 | use std::io::BufReader; |
| 42 | use yaml::constructor::*; |
| 43 | |
| 44 | let data = "[1, 2, 3]"; |
| 45 | let mut reader = BufReader::new(data.as_bytes()); |
| 46 | |
| 47 | yaml::parse_io_utf8(&mut reader); // => Ok(vec![YamlSequence(~[YamlInteger(1), YamlInteger(2), YamlInteger(3)])]) |
| 48 | ~~~~ |
| 49 | |
| 50 | Todo |
| 51 | ---- |
| 52 | |
| 53 | In the order of what I want to do... |
| 54 | |
| 55 | - [x] Emitter functions |
| 56 | - [x] Document iterator |
| 57 | - [x] UTF-16 support |
| 58 | - Complete YAML 1.1 specs |
| 59 | - [ ] Tag support |
| 60 | - [ ] [Timestamp type](http://yaml.org/type/timestamp.html) |
| 61 | - [ ] [Int parser](http://yaml.org/type/int.html) |
| 62 | - [ ] [Float parser](http://yaml.org/type/float.html) |
| 63 | - [ ] Token functions |