saphyr-serde/saphyr/src/lib.rs

50 lines
1.3 KiB
Rust
Raw Normal View History

2024-02-08 06:12:14 +00:00
// Copyright 2015, Yuheng Chen.
// Copyright 2023, Ethiraric.
// See the LICENSE file at the top-level directory of this distribution.
2015-05-31 09:59:43 +00:00
//! YAML 1.2 implementation in pure Rust.
//!
//! # Usage
//!
2024-02-08 06:12:14 +00:00
//! This crate is [on github](https://github.com/Ethiraric/yaml-rust2) and can be used by adding
//! `yaml-rust2` to the dependencies in your project's `Cargo.toml`.
2015-05-31 09:59:43 +00:00
//!
//! ```toml
//! [dependencies]
//! yaml-rust2 = "0.8.0"
2015-05-31 09:59:43 +00:00
//! ```
//!
//! # Examples
//! Parse a string into `Vec<Yaml>` and then serialize it as a YAML string.
2015-05-31 09:59:43 +00:00
//!
//! ```
2024-02-08 06:12:14 +00:00
//! use yaml_rust2::{YamlLoader, YamlEmitter};
2015-05-31 09:59:43 +00:00
//!
//! let docs = YamlLoader::load_from_str("[1, 2, 3]").unwrap();
//! let doc = &docs[0]; // select the first YAML document
2015-05-31 09:59:43 +00:00
//! assert_eq!(doc[0].as_i64().unwrap(), 1); // access elements by index
2015-06-29 16:31:22 +00:00
//!
2015-05-31 09:59:43 +00:00
//! let mut out_str = String::new();
//! let mut emitter = YamlEmitter::new(&mut out_str);
//! emitter.dump(doc).unwrap(); // dump the YAML object to a String
//!
//! ```
2024-03-20 14:50:48 +00:00
#![warn(missing_docs, clippy::pedantic)]
2024-03-19 17:18:59 +00:00
2020-05-26 10:35:06 +00:00
extern crate hashlink;
pub(crate) mod char_traits;
#[macro_use]
pub(crate) mod debug;
2015-05-31 04:56:45 +00:00
pub mod emitter;
2018-09-15 16:49:04 +00:00
pub mod parser;
pub mod scanner;
pub mod yaml;
2015-05-24 19:29:52 +00:00
2015-05-31 09:02:22 +00:00
// reexport key APIs
2020-05-27 06:15:28 +00:00
pub use crate::emitter::{EmitError, YamlEmitter};
pub use crate::parser::Event;
pub use crate::scanner::ScanError;
pub use crate::yaml::{Yaml, YamlLoader};