Trait dbus::arg::RefArg[][src]

pub trait RefArg: Debug + Send + Sync {
Show methods fn arg_type(&self) -> ArgType;
fn signature(&self) -> Signature<'static>;
fn append(&self, _: &mut IterAppend<'_>);
fn as_any(&self) -> &dyn Any
    where
        Self: 'static
;
fn as_any_mut(&mut self) -> &mut dyn Any
    where
        Self: 'static
;
fn box_clone(&self) -> Box<dyn RefArg + 'static>; fn as_i64(&self) -> Option<i64> { ... }
fn as_u64(&self) -> Option<u64> { ... }
fn as_f64(&self) -> Option<f64> { ... }
fn as_str(&self) -> Option<&str> { ... }
fn as_iter<'a>(
        &'a self
    ) -> Option<Box<dyn Iterator<Item = &'a dyn RefArg> + 'a>> { ... }
fn as_static_inner(&self, _index: usize) -> Option<&(dyn RefArg + 'static)>
    where
        Self: 'static
, { ... }
fn array_clone(_arg: &[Self]) -> Option<Box<dyn RefArg + 'static>>
    where
        Self: Sized
, { ... }
}
Expand description

Object safe version of Arg + Append + Get.

Required methods

The corresponding D-Bus argument type code.

The corresponding D-Bus type signature for this type.

Performs the append operation.

Transforms this argument to Any (which can be downcasted to read the current value).

If the type is an array, and the element type is byte, numeric, boolean, or string, then the representation is guaranteed to be a Vec. Arrays of structs, dicts, and so on are not safe to use with this.

Note: The internal representation of complex types (Dict, Struct) is unstable and as_any should not be relied upon for these types. Use as_iter instead.

Transforms this argument to Any (which can be downcasted to read the current value).

If the type is an array, and the element type is byte, numeric, boolean, or string, then the representation is guaranteed to be a Vec. Arrays of structs, dicts, and so on are not safe to use with this.

Note: The internal representation of complex types (Dict, Struct) is unstable and as_any should not be relied upon for these types. Use as_iter instead.

Panic

Will panic if the interior cannot be made mutable, e g, if encapsulated inside a Rc with a reference count > 1.

Deep clone of the RefArg, causing the result to be ’static.

Usable as an escape hatch in case of lifetime problems with RefArg.

In case of complex types (Array, Dict, Struct), the clone is not guaranteed to have the same internal representation as the original.

Provided methods

Try to read the argument as an i64.

Works for: Boolean, Byte, Int16, UInt16, Int32, UInt32, Int64, UnixFd.

Try to read the argument as an u64.

Works for: Boolean, Byte, Int16, UInt16, Int32, UInt32, UInt64.

Try to read the argument as an f64.

Works for: Boolean, Byte, Int16, UInt16, Int32, UInt32, Double.

Try to read the argument as a str.

Works for: String, ObjectPath, Signature.

Try to read the argument as an iterator.

Works for: Array/Dict, Struct, Variant. For Dicts, keys and values are interleaved.

Try to read the inner of an argument, as another argument, specifying an index.

Works for: Variant, Array, Struct, Dict. For Dicts, even indices gets a key, odd indices gets a value.

Deep clone of an array.

This method is used internally by box_clone.

Implementations on Foreign Types

Implementors