pub struct Arguments { /* private fields */ }Expand description
The body of a message being built.
The signature of the arguments is declared up front, since generated code knows it at build time, after which each argument is written in order.
§Examples
use tokio_dbus::Signature;
use tokio_dbus_runtime::Arguments;
let mut arguments = Arguments::new(Signature::new("su")?)?;
arguments.store("Hello World!");
arguments.store(&42u32);Implementations§
Source§impl Arguments
impl Arguments
Sourcepub fn new(signature: &Signature) -> Result<Self>
pub fn new(signature: &Signature) -> Result<Self>
Construct an argument list matching the given signature.
Sourcepub fn new_const(signature: &'static Signature) -> Self
pub fn new_const(signature: &'static Signature) -> Self
Construct an argument list matching a signature which is known at compile time.
This is the infallible form of new(), for the common case where the
signature comes out of Signature::new_const and has therefore
already been validated at compile time.
§Examples
use tokio_dbus::Signature;
use tokio_dbus_runtime::Arguments;
const SIGNATURE: &Signature = Signature::new_const(b"su");
let mut arguments = Arguments::new_const(SIGNATURE);
arguments.store("Hello World!");
arguments.store(&42u32);Sourcepub fn store_variant<T>(&mut self, signature: &Signature, value: T) -> &mut Selfwhere
T: Encode,
pub fn store_variant<T>(&mut self, signature: &Signature, value: T) -> &mut Selfwhere
T: Encode,
Write the next argument as a variant containing a value of the given type.
The signature is the one of the value inside the variant, not the v of
the variant itself.
§Examples
use tokio_dbus::Signature;
use tokio_dbus_runtime::Arguments;
let mut arguments = Arguments::new(Signature::VARIANT)?;
arguments.store_variant(Signature::UINT32, 42u32);Sourcepub fn store_variant_dict(&mut self) -> VariantDict<'_>
pub fn store_variant_dict(&mut self) -> VariantDict<'_>
Write the next argument as an a{sv}, which is how a set of properties
of differing types is carried.
§Examples
use tokio_dbus::Signature;
use tokio_dbus_runtime::Arguments;
let mut arguments = Arguments::new(Signature::new("a{sv}")?)?;
let mut dict = arguments.store_variant_dict();
dict.entry("Version", Signature::UINT32, 3u32);
dict.entry("Status", Signature::STRING, "normal");
dict.finish();Trait Implementations§
Auto Trait Implementations§
impl Freeze for Arguments
impl RefUnwindSafe for Arguments
impl Send for Arguments
impl Sync for Arguments
impl Unpin for Arguments
impl UnsafeUnpin for Arguments
impl UnwindSafe for Arguments
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more