usesuper::*; use {message, Signature}; use std::any;
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)] /// A simple wrapper to specify a D-Bus variant. /// /// See the argument guide and module level documentation for details and examples. pubstruct Variant<T>(pub T);
impl Variant<Box<RefArg>> { /// Creates a new refarg from an Iter. Mainly for internal use. pubfn new_refarg<'a>(i: &mut Iter<'a>) -> Option<Self> {
i.recurse(ArgType::Variant).and_then(|mut si| si.get_refarg()).map(|v| Variant(v))
}
}
impl Default for Variant<Box<RefArg>> { // This is a bit silly, because there is no such thing as a default argument. // Unfortunately due to a design mistake while making the SignalArgs trait, we'll // have to work around that by adding a default implementation here. // https://github.com/diwic/dbus-rs/issues/136 fn default() -> Self { Variant(Box::new(0u8) asBox<RefArg>) }
}
impl<T: Arg + Append> Append for Variant<T> { fn append(self, i: &mut IterAppend) { let z = self.0;
i.append_container(ArgType::Variant, Some(T::signature().as_cstr()), |s| z.append(s));
}
}
impl Append for Variant<message::MessageItem> { fn append(self, i: &mut IterAppend) { let z = self.0; let asig = z.signature(); let sig = asig.as_cstr();
i.append_container(ArgType::Variant, Some(&sig), |s| z.append(s));
}
}
impl Append for Variant<Box<RefArg>> { fn append(self, i: &mut IterAppend) { let z = self.0;
i.append_container(ArgType::Variant, Some(z.signature().as_cstr()), |s| z.append(s));
}
}
struct_impl!(a A,);
struct_impl!(a A, b B,);
struct_impl!(a A, b B, c C,);
struct_impl!(a A, b B, c C, d D,);
struct_impl!(a A, b B, c C, d D, e E,);
struct_impl!(a A, b B, c C, d D, e E, f F,);
struct_impl!(a A, b B, c C, d D, e E, f F, g G,);
struct_impl!(a A, b B, c C, d D, e E, f F, g G, h H,);
struct_impl!(a A, b B, c C, d D, e E, f F, g G, h H, i I,);
struct_impl!(a A, b B, c C, d D, e E, f F, g G, h H, i I, j J,);
struct_impl!(a A, b B, c C, d D, e E, f F, g G, h H, i I, j J, k K,);
struct_impl!(a A, b B, c C, d D, e E, f F, g G, h H, i I, j J, k K, l L,);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.