All Projects → ron-rs → Ron

ron-rs / Ron

Licence: other
Rusty Object Notation

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Ron

Protobuf Nim
Protobuf implementation in pure Nim that leverages the power of the macro system to not depend on any external tools
Stars: ✭ 90 (-95.09%)
Mutual labels:  serialization
Store
Fast binary serialization in Haskell
Stars: ✭ 100 (-94.55%)
Mutual labels:  serialization
Dotfiles
▒ rice ░░ custom linux config files
Stars: ✭ 1,514 (-17.45%)
Mutual labels:  configs
Java
jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go
Stars: ✭ 1,308 (-28.68%)
Mutual labels:  serialization
Msgpack
msgpack.org[Go] MessagePack encoding for Golang
Stars: ✭ 1,353 (-26.23%)
Mutual labels:  serialization
Yamldotnet
YamlDotNet is a .NET library for YAML
Stars: ✭ 1,382 (-24.65%)
Mutual labels:  serialization
Datakernel
Alternative Java platform, built from the ground up - with its own async I/O core and DI. Ultra high-performance, simple and minimalistic - redefines server-side programming, web-development and highload!
Stars: ✭ 87 (-95.26%)
Mutual labels:  serialization
Typical
Typical: Fast, simple, & correct data-validation using Python 3 typing.
Stars: ✭ 111 (-93.95%)
Mutual labels:  serialization
Succ
Sexy and Utilitarian Code Configuration
Stars: ✭ 100 (-94.55%)
Mutual labels:  serialization
Protobuf
Protocol Buffers - Google's data interchange format
Stars: ✭ 52,305 (+2751.96%)
Mutual labels:  serialization
Edn format
EDN reader and writer implementation in Python, using PLY (lex, yacc)
Stars: ✭ 92 (-94.98%)
Mutual labels:  serialization
Fast Serialization
FST: fast java serialization drop in-replacement
Stars: ✭ 1,348 (-26.5%)
Mutual labels:  serialization
Loopback Component Jsonapi
JSONAPI support for loopback.
Stars: ✭ 104 (-94.33%)
Mutual labels:  serialization
Go
A high-performance 100% compatible drop-in replacement of "encoding/json"
Stars: ✭ 10,248 (+458.78%)
Mutual labels:  serialization
Faraday
Serialization library built for speed and memory efficiency
Stars: ✭ 110 (-94%)
Mutual labels:  serialization
Msgpack Scala
MessagePack serializer implementation for Scala / msgpack.org[Scala]
Stars: ✭ 87 (-95.26%)
Mutual labels:  serialization
Hprose Delphi
Hprose is a cross-language RPC. This project is Hprose 2.0 for Delphi and FreePascal
Stars: ✭ 100 (-94.55%)
Mutual labels:  serialization
Datafiles
A file-based ORM for Python dataclasses.
Stars: ✭ 113 (-93.84%)
Mutual labels:  serialization
Pretty Yaml
PyYAML-based module to produce pretty and readable YAML-serialized data
Stars: ✭ 110 (-94%)
Mutual labels:  serialization
Undopro
UndoPro is a command-based undo system integrated into Unity's default system. This allows devs to use actions for their undo/redo operations without forcing the user into a new undo-workflow!
Stars: ✭ 107 (-94.17%)
Mutual labels:  serialization

Rusty Object Notation

CI Crates.io MSRV Docs Matrix

RON is a simple readable data serialization format that looks similar to Rust syntax. It's designed to support all of Serde's data model, so structs, enums, tuples, arrays, generic maps, and primitive values.

Example

GameConfig( // optional struct name
    window_size: (800, 600),
    window_title: "PAC-MAN",
    fullscreen: false,
    
    mouse_sensitivity: 1.4,
    key_bindings: {
        "up": Up,
        "down": Down,
        "left": Left,
        "right": Right,
        
        // Uncomment to enable WASD controls
        /*
        "W": Up,
        "A": Down,
        "S": Left,
        "D": Right,
        */
    },
    
    difficulty_options: (
        start_difficulty: Easy,
        adaptive: false,
    ),
)

Why RON?

Example in JSON

{
   "materials": {
        "metal": {
            "reflectivity": 1.0
        },
        "plastic": {
            "reflectivity": 0.5
        }
   },
   "entities": [
        {
            "name": "hero",
            "material": "metal"
        },
        {
            "name": "monster",
            "material": "plastic"
        }
   ]
}

Same example in RON

Scene( // class name is optional
    materials: { // this is a map
        "metal": (
            reflectivity: 1.0,
        ),
        "plastic": (
            reflectivity: 0.5,
        ),
    },
    entities: [ // this is an array
        (
            name: "hero",
            material: "metal",
        ),
        (
            name: "monster",
            material: "plastic",
        ),
    ],
)

Note the following advantages of RON over JSON:

  • trailing commas allowed
  • single- and multi-line comments
  • field names aren't quoted, so it's less verbose
  • optional struct names improve readability
  • enums are supported (and less verbose than their JSON representation)

RON syntax overview

  • Numbers: 42, 3.14, 0xFF, 0b0110
  • Strings: "Hello", "with\\escapes\n", r#"raw string, great for regex\."#
  • Booleans: true, false
  • Chars: 'e', '\n'
  • Optionals: Some("string"), Some(Some(1.34)), None
  • Tuples: ("abc", 1.23, true), ()
  • Lists: ["abc", "def"]
  • Structs: ( foo: 1.0, bar: ( baz: "I'm nested" ) )
  • Maps: { "arbitrary": "keys", "are": "allowed" }

Note: Serde's data model represents fixed-size Rust arrays as tuple (instead of as list)

Quickstart

Cargo.toml

[dependencies]
ron = "0.7"
serde = { version = "1", features = ["derive"] }

main.rs

use serde::{Deserialize, Serialize};

#[derive(Debug, Deserialize, Serialize)]
struct MyStruct {
    boolean: bool,
    float: f32,
}

fn main() {
    let x: MyStruct = ron::from_str("(boolean: true, float: 1.23)").unwrap();
    
    println!("RON: {}", ron::to_string(&x).unwrap());
}

Tooling

Editor Plugin
IntelliJ intellij-ron
VS Code a5huynh/vscode-ron
Sublime Text RON
Atom language-ron
Vim ron-rs/ron.vim
EMACS emacs-ron

Specification

There is a very basic, work in progress specification available on the wiki page. A more formal and complete grammar is available here.

License

RON is dual-licensed under Apache-2.0 and MIT.

Any contribution intentionally submitted for inclusion in the work must be provided under the same dual-license terms.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].