summaryrefslogtreecommitdiffstats
path: root/third_party/rust/serde_yaml/src/lib.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /third_party/rust/serde_yaml/src/lib.rs
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/serde_yaml/src/lib.rs')
-rw-r--r--third_party/rust/serde_yaml/src/lib.rs109
1 files changed, 109 insertions, 0 deletions
diff --git a/third_party/rust/serde_yaml/src/lib.rs b/third_party/rust/serde_yaml/src/lib.rs
new file mode 100644
index 0000000000..42f00431a3
--- /dev/null
+++ b/third_party/rust/serde_yaml/src/lib.rs
@@ -0,0 +1,109 @@
+//! This crate is a Rust library for using the [Serde] serialization framework
+//! with data in [YAML] file format.
+//!
+//! This library does not reimplement a YAML parser; it uses [yaml-rust] which
+//! is a pure Rust YAML 1.2 implementation.
+//!
+//! [Serde]: https://github.com/serde-rs/serde
+//! [YAML]: http://yaml.org
+//! [yaml-rust]: https://github.com/chyh1990/yaml-rust
+//!
+//! # Examples
+//!
+//! ```edition2018
+//! use std::collections::BTreeMap;
+//!
+//! fn main() -> Result<(), serde_yaml::Error> {
+//! // You have some type.
+//! let mut map = BTreeMap::new();
+//! map.insert("x".to_string(), 1.0);
+//! map.insert("y".to_string(), 2.0);
+//!
+//! // Serialize it to a YAML string.
+//! let s = serde_yaml::to_string(&map)?;
+//! assert_eq!(s, "---\nx: 1.0\ny: 2.0");
+//!
+//! // Deserialize it back to a Rust type.
+//! let deserialized_map: BTreeMap<String, f64> = serde_yaml::from_str(&s)?;
+//! assert_eq!(map, deserialized_map);
+//! Ok(())
+//! }
+//! ```
+//!
+//! ## Using Serde derive
+//!
+//! It can also be used with Serde's serialization code generator `serde_derive` to
+//! handle structs and enums defined in your own program.
+//!
+//! ```edition2018
+//! # use serde_derive::{Serialize, Deserialize};
+//! use serde::{Serialize, Deserialize};
+//!
+//! #[derive(Debug, PartialEq, Serialize, Deserialize)]
+//! struct Point {
+//! x: f64,
+//! y: f64,
+//! }
+//!
+//! fn main() -> Result<(), serde_yaml::Error> {
+//! let point = Point { x: 1.0, y: 2.0 };
+//!
+//! let s = serde_yaml::to_string(&point)?;
+//! assert_eq!(s, "---\nx: 1.0\ny: 2.0");
+//!
+//! let deserialized_point: Point = serde_yaml::from_str(&s)?;
+//! assert_eq!(point, deserialized_point);
+//! Ok(())
+//! }
+//! ```
+
+#![doc(html_root_url = "https://docs.rs/serde_yaml/0.8.9")]
+#![deny(missing_docs)]
+#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
+#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
+// Whitelisted clippy lints
+#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]
+// Whitelisted clippy_pedantic lints
+#![cfg_attr(feature = "cargo-clippy", allow(
+ // private Deserializer::next
+ should_implement_trait,
+ // things are often more readable this way
+ cast_lossless,
+ module_name_repetitions,
+ single_match_else,
+ use_self,
+ // code is acceptable
+ cast_possible_wrap,
+ cast_precision_loss,
+ cast_sign_loss,
+ // not practical
+ indexing_slicing,
+ missing_docs_in_private_items,
+ // not stable
+ empty_enum,
+ // meh, some things won't fail
+ result_unwrap_used,
+))]
+
+extern crate dtoa;
+extern crate linked_hash_map;
+#[macro_use]
+extern crate serde;
+extern crate yaml_rust;
+
+pub use self::de::{from_reader, from_slice, from_str};
+pub use self::error::{Error, Location, Result};
+pub use self::mapping::Mapping;
+pub use self::ser::{to_string, to_vec, to_writer};
+pub use self::value::{from_value, to_value, Index, Number, Sequence, Value};
+
+mod de;
+mod error;
+mod mapping;
+mod number;
+mod path;
+mod ser;
+mod value;
+
+#[allow(non_camel_case_types)]
+enum private {}