Comments (3)
First, here's some code which is the bottom half of your first example, modified:
let test: dbus::arg::Dict<&str, dbus::arg::Dict<&str, dbus::arg::Variant<dbus::arg::Iter>, _>, _> =
response.get1().unwrap();
for (k1, v1) in test {
println!("outer key = {:?}", k1);
for (k2, v2) in v1 {
println!(" inner key = {:?}, inner type = {:?}, string value = {:?}", k2, v2, v2.0.clone().get::<&str>());
}
}
}
You need to use Variant<Iter>
if you don't know what's inside your variant when you get it. You will then have to use get::<&str>()
, get::<u32>()
, etc to retreive the actual value inside the variant.
from dbus-rs.
I thought the whole point of Variant is that it can hold different types of data?
The Variant story is a bit tricky since Rust is so strongly typed. I'm working on using trait objects for better dynamics but I'm not sure I have arrived at the best design yet.
it prints out Dict(Iter("Unknown?!", "Unknown?!", "Unknown?!", "Unknown?!", "Unknown?!"), PhantomData). What is the Unknown?! value?
This is fixed in git master. It now prints Dict(Iter(DictEntry, DictEntry, DictEntry, DictEntry), PhantomData)
instead (as many as there are dict entries).
from dbus-rs.
Great, thank you! I knew I must of been missing something simple :)
from dbus-rs.
Related Issues (20)
- dbus-crossroads: cr.insert() during sync method call HOT 1
- GetManagedObjects doesn't respond with async properties HOT 6
- Use standard library `OwnedFd` HOT 10
- Crossroads::get_children() returns not children but descendants HOT 1
- Multi-interface fdo Properties GetAll behaves erratically with async properties HOT 2
- fdo ObjectManager GetManagedObjects method panics with multiple objects and async properties HOT 1
- "vendored" feature fails to compile HOT 7
- Possible deadlock in dbus-tokio HOT 4
- Crossroad example not working HOT 1
- `vendored` feature's build script writes outside of `$OUT_DIR` HOT 5
- async monitor? HOT 4
- monitor system bus without root privileges HOT 4
- [Help] When variant is a struct? HOT 10
- dbus-codegen: When crossroads is enabled, no client-side code is generated HOT 3
- dbus-codegen: Add attribute to specify rust type for method arguments HOT 4
- Annotations on interfaces not shown in introspection
- Any way to set uid in dbus authentication? HOT 6
- How to ensure that libdbus-sys compiles with X11 for dbus-daemon autolaunch on build HOT 4
- register object of type X on dbus? HOT 3
- pkg config failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbus-rs.