Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use/fix ron code blocks #541

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ structs, enums, tuples, arrays, generic maps, and primitive values.

## Example

```rust,ignore
```ron
GameConfig( // optional struct name
window_size: (800, 600),
window_title: "PAC-MAN",
Expand Down Expand Up @@ -98,7 +98,7 @@ There also is a very basic, work in progress specification available on

### Same example in RON

```rust,ignore
```ron
Scene( // class name is optional
materials: { // this is a map
"metal": (
Expand Down
8 changes: 4 additions & 4 deletions docs/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ struct Object {

Without `unwrap_newtypes`, because the value `5` can not be saved into `NewType(u32)`, your RON document would look like this:

``` ron
```ron
(
new_type: (5),
)
```

With the `unwrap_newtypes` extension, this coercion is done automatically. So `5` will be interpreted as `(5)`.

``` ron
```ron
#![enable(unwrap_newtypes)]
(
new_type: 5,
Expand Down Expand Up @@ -98,15 +98,15 @@ pub enum Enum {

Without `unwrap_variant_newtypes`, your RON document would look like this:

``` ron
```ron
(
variant: A(Inner(a: 4, b: true)),
)
```

With the `unwrap_variant_newtypes` extension, the first structural layer inside a newtype variant will be unwrapped automatically:

``` ron
```ron
#![enable(unwrap_newtypes)]
(
variant: A(a: 4, b: true),
Expand Down
Loading