I have an object and I would like to know what fields are possibly available for that object, is there a way to do that?
In my specific case,
the type of my object is jsonrpc_client_core::Error,
and I can use println!("error: {:#?}) and see the output:
JsonRpcError(
Error {
code: ServerError(
-32027,
),
message: "Failed to connect to network wlan0 for peach-probe-test-ssid",
data: None,
},
),
State {
next_error: None,
backtrace: InternalBacktrace {
backtrace: None,
},
},
)
However, when I try to access a field via:
e.code
I get the compilation error:
error[E0609]: no field `code` on type `jsonrpc_client_core::Error
How can I see what fields I am actually able to access on an object? I would prefer a way to do it programmatically instead of by looking in documentation.
In the end my goal is to get the value of the code field so I can do something with it.
Thanks for any help!