diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /third_party/rust/ron/src/lib.rs | |
parent | Initial commit. (diff) | |
download | firefox-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/ron/src/lib.rs')
-rw-r--r-- | third_party/rust/ron/src/lib.rs | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/third_party/rust/ron/src/lib.rs b/third_party/rust/ron/src/lib.rs new file mode 100644 index 0000000000..d9bf34ae5a --- /dev/null +++ b/third_party/rust/ron/src/lib.rs @@ -0,0 +1,75 @@ +/*! +RON is a simple config format which looks similar to Rust syntax. + +## Features + +* Data types + * Structs, typename optional + * Tuples + * Enums + * Lists + * Maps + * Units (`()`) + * Optionals + * Primitives: booleans, numbers, string, char +* Allows nested layout (similar to JSON) +* Supports comments +* Trailing commas +* Pretty serialization + +## Syntax example + +```rust,ignore +Game( + title: "Hello, RON!", + level: Level( // We could just leave the `Level` out + buildings: [ + ( + size: (10, 20), + color: Yellow, // This as an enum variant + owner: None, + ), + ( + size: (20, 25), + color: Custom(0.1, 0.8, 1.0), + owner: Some("guy"), + ), + ], + characters: { + "guy": ( + friendly: true, + ), + }, + ), +) +``` + +## Usage + +Just add it to your `Cargo.toml`: + +```toml +[dependencies] +ron = "*" +``` + +Serializing / Deserializing is as simple as calling `to_string` / `from_str`. + +!*/ + +#![doc(html_root_url = "https://docs.rs/ron/0.6.0")] + +pub mod de; +pub mod ser; + +pub mod error; +pub mod value; + +pub mod extensions; + +pub use de::{from_str, Deserializer}; +pub use error::{Error, Result}; +pub use ser::{to_string, Serializer}; +pub use value::{Map, Number, Value}; + +mod parse; |