macro_rules! method_return_signature { ($member:expr) => { ... }; (member: $member:expr) => { ... }; ($member:expr, $interface:expr) => { ... }; (member: $member:expr, interface: $interface:expr) => { ... }; ($member:expr, $interface:expr, $argument:expr) => { ... }; (member: $member:expr, interface: $interface:expr, argument: $argument:expr) => { ... }; }
Expand description
Retrieve the signature of a method’s return type.
This macro will take a method member name and return the signature of the return type.
Essentially a wrapper around [zbus_lockstep::get_method_return_type
],
but this macro tries to do its job with less arguments.
It will search in the XML specification of the method for the return type and return the signature of that type.
If multiple interfaces offer the same method, you will need to specify the interface name as well.
This macro can be called with or without the interface name.
§Examples
Basic usage:
use zbus_lockstep::method_return_signature;
use zvariant::Signature;
std::env::set_var("LOCKSTEP_XML_PATH", "../xml");
let sig = method_return_signature!("RequestName");
assert_eq!(&sig, &Signature::from_str_unchecked("u"));
The macro supports colling arguments with identifiers as well as without. The macro may also be called with an interface name or interface and argument name:
let _sig = method_return_signature!("RequestName", "org.example.Node", "grape");
// or alternatively
let _sig = method_return_signature!(member: "RequestName", interface: "org.example.Node", argument: "grape");