Some DBus methods return file descriptors, such as
"org.freedesktop.login1.Manager.Inhibit". This commit adds support for
these.
I followed the same enum type defining pattern I've seen in the code,
such as with InterfaceNames and BusNames, to prevent integers and
fileDescriptors implicitly casting to each other.
Note that it is kinda hard to test with reading and writing
fileDescriptors, as DBus will duplicate the file descriptor
when reading, leading to relatively unpredicatable behaviour.
I also must admit I focussed most of my attention to reading file
descriptors and less to writing file descriptors, as I don't know a good
way to test those.
the busName and interfacePath types transparently cast down to a string,
(but not the other way around) so they are a perfect upgrade to
type-safety. The only downside to them is that templates can often get
them wrong. std.conv.to will return with a cast(T) prefix, which could
slightly break existing code.
I think the type-safety advantages are outweighing this corner case
though. The current API has been fully upgraded and examples still run
and work.
Note: structs are deliberately considered last, because other stuff may
be implemented as structs as well. So we need to take care of special
cases before trying struct (de)serialization.
Some templates broke because canDBus!(DictionaryEntry!(K,V)) now returns false.
Also, associative arrays are now handled without using a DictionaryEntry type. This is a first step in eliminating DictionaryEntry.
- Keys in a dictionary are required to be basic types
- A DictionaryEntry on it's own cannot be sent over DBus, it has to be wrapped in an array to form a dictionary. So, canDBus should be false for DictionaryEntry, but true for an array of DictionaryEntry.