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

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
18 checks passed
@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