Macro zbus_lockstep::method_args_signature
source · macro_rules! method_args_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 arguments.
Essentially a wrapper around [zbus_lockstep::get_method_args_type
],
but this macro tries to do its job with less arguments.
This macro will take a method member name and return the signature of the arguments type.
It will search in the XML specification of the method for the arguments type and return the signature of that type.
If multiple interfaces offer the same member, you will need to specify the interface name as well.
This macro can be called with or without the interface name.
§Examples
use zbus_lockstep::method_args_signature;
use zvariant::Signature;
std::env::set_var("LOCKSTEP_XML_PATH", "../xml");
let sig = method_args_signature!("RequestName");
assert_eq!(&sig, &Signature::from_str_unchecked("(su)"));
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_args_signature!("RequestName", "org.example.Node", "apple");
// or alternatively
let _sig = method_args_signature!(member: "RequestName", interface: "org.example.Node", argument: "apple");