Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Handwrite a better Debug for Value #287

Merged
merged 3 commits into from Jul 28, 2022
Merged

Handwrite a better Debug for Value #287

merged 3 commits into from Jul 28, 2022

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Jul 28, 2022

YAML input:

Null: ~
Bool: true
Number: 1
String: ...
Sequence:
  - true
EmptySequence: []
Mapping:
  k: v
EmptyMapping: {}
Tagged: !tag true

Before:

Mapping(
    Mapping {
        map: {
            String(
                "Null",
            ): Null,
            String(
                "Bool",
            ): Bool(
                true,
            ),
            String(
                "Number",
            ): Number(
                PosInt(
                    1,
                ),
            ),
            String(
                "String",
            ): String(
                "...",
            ),
            String(
                "Sequence",
            ): Sequence(
                [
                    Bool(
                        true,
                    ),
                ],
            ),
            String(
                "EmptySequence",
            ): Sequence(
                [],
            ),
            String(
                "Mapping",
            ): Mapping(
                Mapping {
                    map: {
                        String(
                            "k",
                        ): String(
                            "v",
                        ),
                    },
                },
            ),
            String(
                "EmptyMapping",
            ): Mapping(
                Mapping {
                    map: {},
                },
            ),
            String(
                "Tagged",
            ): Tagged(
                TaggedValue {
                    tag: !tag,
                    value: Bool(
                        true,
                    ),
                },
            ),
        },
    },
)

After:

Mapping {
    "Null": Null,
    "Bool": Bool(true),
    "Number": Number(1),
    "String": String("..."),
    "Sequence": Sequence [
        Bool(true),
    ],
    "EmptySequence": Sequence [],
    "EmptyMapping": Mapping {},
    "Tagged": TaggedValue {
        tag: !tag,
        value: Bool(true),
    },
}

@dtolnay dtolnay merged commit 83a5cec into master Jul 28, 2022
@dtolnay dtolnay deleted the debug branch July 28, 2022 17:33
Repository owner locked and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant