Debugger display rust enums

60 Views Asked by At

I have a bigger project using enums with structs inside them and I have problem with vscode debugger not being able to display anything. I wrote simple test program to demonstrate the issue. Is there any way I can help the debugger display the values?

Simple program:

struct TestStruct {
    a: u32
}

enum TestEnum {
    Test(TestStruct),
    None,
}

fn main() {
    let what_am_i = TestEnum::None;
    println!("Hello");
}

My launch config

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "Debug executable 'rust-test'",
            "cargo": {
                "args": [
                    "build",
                    "--bin=rust-test",
                    "--package=rust-test"
                ],
                "filter": {
                    "name": "rust-test",
                    "kind": "bin"
                }
            },
            "args": [],
            "cwd": "${workspaceFolder}"
        }
    ]
}

Debugger shows: enter image description here

If I remove Test(TestStruct) debugger show correctly: enter image description here

0

There are 0 best solutions below