This all works quite well until I have to get the data out of these. Do I have an XConfig or SConfig? Trying to match doesn't seem to work because match takes the first arm as the expected type and the second arm becomes a mismatched type.
I am wondering how to solve this. Would a Traits with for the two Config types do it?
I'm not familiar with the protocol, but if you can have an XConfig XOR an SConfig XOR an RpcError, wouldn't it be better to represent Config as an enum?
I think I got it to work, however, I don't understand exactly how I got it to work. I definitely need to understand what is going on under the hood when creating enums of structs as well as items behind a shared reference. But here's ultimately what I came up with:
In tests, I called like so:
let result = nc.get_config("running", None);
if result.is_some() {
let c = result.unwrap();
let d = c.rpc_reply(&c);