diff --git a/source/ddbus/conv.d b/source/ddbus/conv.d index 7979667..c4891d5 100644 --- a/source/ddbus/conv.d +++ b/source/ddbus/conv.d @@ -122,7 +122,7 @@ void buildIter(TS...)(DBusMessageIter *iter, TS args) if(allCanDBus!TS) { } if(val.explicitVariant) dbus_message_iter_close_container(iter, sub); - } else static if(isVariant!T) { + } else static if(isInstanceOf!(Variant, T)) { DBusMessageIter sub; const(char)* subSig = typeSig!(VariantType!T).toStringz(); dbus_message_iter_open_container(iter, 'v', subSig, &sub); @@ -188,7 +188,7 @@ T readIter(T)(DBusMessageIter *iter) if (!is(T == enum) && !isInstanceOf!(BitFla auto argType = dbus_message_iter_get_arg_type(iter); T ret; - static if(!isVariant!T || is(T == Variant!DBusAny)) { + static if(!isInstanceOf!(Variant, T) || is(T == Variant!DBusAny)) { if(argType == 'v') { DBusMessageIter sub; dbus_message_iter_recurse(iter, &sub); @@ -242,7 +242,7 @@ T readIter(T)(DBusMessageIter *iter) if (!is(T == enum) && !isInstanceOf!(BitFla ret ~= readIter!U(&sub); } } - } else static if(isVariant!T) { + } else static if(isInstanceOf!(Variant, T)) { DBusMessageIter sub; dbus_message_iter_recurse(iter, &sub); ret.data = readIter!(VariantType!T)(&sub); diff --git a/source/ddbus/util.d b/source/ddbus/util.d index 7aa55ee..a381ca0 100644 --- a/source/ddbus/util.d +++ b/source/ddbus/util.d @@ -17,6 +17,15 @@ auto byDictionaryEntries(K, V)(V[K] aa) { return aa.byKeyValue.map!(pair => DictionaryEntry!(K, V)(pair.key, pair.value)); } +/+ + Predicate template indicating whether T is an instance of ddbus.thin.Variant. + + Deprecated: + This template used to be undocumented and user code should not depend on it. + Its meaning became unclear when support for Phobos-style variants was added. + It seemed best to remove it at that point. ++/ +deprecated("Use std.traits.isInstanceOf instead.") template isVariant(T) { static if(isBasicType!T || isInputRange!T) { enum isVariant = false; @@ -61,7 +70,7 @@ template basicDBus(T) { template canDBus(T) { static if(basicDBus!T || is(T == DBusAny)) { enum canDBus = true; - } else static if(isVariant!T) { + } else static if(isInstanceOf!(Variant, T)) { enum canDBus = canDBus!(VariantType!T); } else static if(isInstanceOf!(VariantN, T)) { // Phobos-style variants are supported if limited to DBus compatible types. @@ -116,7 +125,7 @@ string typeSig(T)() if(canDBus!T) { return "s"; } else static if(is(T == ObjectPath)) { return "o"; - } else static if(isVariant!T || isInstanceOf!(VariantN, T)) { + } else static if(isInstanceOf!(Variant, T) || isInstanceOf!(VariantN, T)) { return "v"; } else static if(is(T B == enum)) { return typeSig!B;