RON language preview
1. A basic config struct
an attribute, a named struct, and typed fields
horizon-dark
#![enable(implicit_some)]
GameConfig(
window_title: "My Game",
resolution: (1920, 1080),
fullscreen: false,
volume: 0.8,
difficulty: Hard,
save_slot: None,
tags: ["action", "rpg"],
)
atom-one-dark
#![enable(implicit_some)]
GameConfig(
window_title: "My Game",
resolution: (1920, 1080),
fullscreen: false,
volume: 0.8,
difficulty: Hard,
save_slot: None,
tags: ["action", "rpg"],
)
github-dark
#![enable(implicit_some)]
GameConfig(
window_title: "My Game",
resolution: (1920, 1080),
fullscreen: false,
volume: 0.8,
difficulty: Hard,
save_slot: None,
tags: ["action", "rpg"],
)
dracula
#![enable(implicit_some)]
GameConfig(
window_title: "My Game",
resolution: (1920, 1080),
fullscreen: false,
volume: 0.8,
difficulty: Hard,
save_slot: None,
tags: ["action", "rpg"],
)
nord
#![enable(implicit_some)]
GameConfig(
window_title: "My Game",
resolution: (1920, 1080),
fullscreen: false,
volume: 0.8,
difficulty: Hard,
save_slot: None,
tags: ["action", "rpg"],
)
github
#![enable(implicit_some)]
GameConfig(
window_title: "My Game",
resolution: (1920, 1080),
fullscreen: false,
volume: 0.8,
difficulty: Hard,
save_slot: None,
tags: ["action", "rpg"],
)
2. Maps and nested structs
map literals and nested struct values
horizon-dark
Scene(
name: "Level1",
entities: {
"player": Entity(position: (0.0, 0.0), health: 100),
"enemy1": Entity(position: (10.0, 5.0), health: 50),
},
)
atom-one-dark
Scene(
name: "Level1",
entities: {
"player": Entity(position: (0.0, 0.0), health: 100),
"enemy1": Entity(position: (10.0, 5.0), health: 50),
},
)
github-dark
Scene(
name: "Level1",
entities: {
"player": Entity(position: (0.0, 0.0), health: 100),
"enemy1": Entity(position: (10.0, 5.0), health: 50),
},
)
dracula
Scene(
name: "Level1",
entities: {
"player": Entity(position: (0.0, 0.0), health: 100),
"enemy1": Entity(position: (10.0, 5.0), health: 50),
},
)
nord
Scene(
name: "Level1",
entities: {
"player": Entity(position: (0.0, 0.0), health: 100),
"enemy1": Entity(position: (10.0, 5.0), health: 50),
},
)
github
Scene(
name: "Level1",
entities: {
"player": Entity(position: (0.0, 0.0), health: 100),
"enemy1": Entity(position: (10.0, 5.0), health: 50),
},
)
3. Numbers and strings
hex/binary numbers, raw strings, and byte strings
horizon-dark
Settings(
flags: 0xFF,
mask: 0b1010_0101,
label: r#"raw "quoted" text"#,
magic: b"\x00\x01",
)
atom-one-dark
Settings(
flags: 0xFF,
mask: 0b1010_0101,
label: r#"raw "quoted" text"#,
magic: b"\x00\x01",
)
github-dark
Settings(
flags: 0xFF,
mask: 0b1010_0101,
label: r#"raw "quoted" text"#,
magic: b"\x00\x01",
)
dracula
Settings(
flags: 0xFF,
mask: 0b1010_0101,
label: r#"raw "quoted" text"#,
magic: b"\x00\x01",
)
nord
Settings(
flags: 0xFF,
mask: 0b1010_0101,
label: r#"raw "quoted" text"#,
magic: b"\x00\x01",
)
github
Settings(
flags: 0xFF,
mask: 0b1010_0101,
label: r#"raw "quoted" text"#,
magic: b"\x00\x01",
)