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

pub trait RefArg: Debug + Send + Sync {
    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
, { ... } }

Object safe version of Arg + Append + Get.

Required methods

fn arg_type(&self) -> ArgType[src]

The corresponding D-Bus argument type code.

fn signature(&self) -> Signature<'static>[src]

The corresponding D-Bus type signature for this type.

fn append(&self, _: &mut IterAppend<'_>)[src]

Performs the append operation.

fn as_any(&self) -> &dyn Any where
    Self: 'static, 
[src]

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.

fn as_any_mut(&mut self) -> &mut dyn Any where
    Self: 'static, 
[src]

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.

fn box_clone(&self) -> Box<dyn RefArg + 'static>[src]

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.

Loading content...

Provided methods

fn as_i64(&self) -> Option<i64>[src]

Try to read the argument as an i64.

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

fn as_u64(&self) -> Option<u64>[src]

Try to read the argument as an u64.

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

fn as_f64(&self) -> Option<f64>[src]

Try to read the argument as an f64.

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

fn as_str(&self) -> Option<&str>[src]

Try to read the argument as a str.

Works for: String, ObjectPath, Signature.

fn as_iter<'a>(
    &'a self
) -> Option<Box<dyn Iterator<Item = &'a dyn RefArg> + 'a>>
[src]

Try to read the argument as an iterator.

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

fn as_static_inner(&self, _index: usize) -> Option<&(dyn RefArg + 'static)> where
    Self: 'static, 
[src]

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.

fn array_clone(_arg: &[Self]) -> Option<Box<dyn RefArg + 'static>> where
    Self: Sized
[src]

Deep clone of an array.

This method is used internally by box_clone.

Loading content...

Implementations on Foreign Types

impl<'a, T: RefArg + ?Sized> RefArg for &'a T[src]

impl<T: RefArg + ?Sized> RefArg for Box<T>[src]

impl<T: RefArg + ?Sized> RefArg for Arc<T>[src]

impl RefArg for u8[src]

impl RefArg for i16[src]

impl RefArg for u16[src]

impl RefArg for i32[src]

impl RefArg for u32[src]

impl RefArg for i64[src]

impl RefArg for u64[src]

impl RefArg for bool[src]

impl RefArg for f64[src]

impl RefArg for String[src]

impl RefArg for File[src]

impl<A: RefArg> RefArg for (A,)[src]

impl<A: RefArg, B: RefArg> RefArg for (A, B)[src]

impl<A: RefArg, B: RefArg, C: RefArg> RefArg for (A, B, C)[src]

impl<A: RefArg, B: RefArg, C: RefArg, D: RefArg> RefArg for (A, B, C, D)[src]

impl<A: RefArg, B: RefArg, C: RefArg, D: RefArg, E: RefArg> RefArg for (A, B, C, D, E)[src]

impl<A: RefArg, B: RefArg, C: RefArg, D: RefArg, E: RefArg, F: RefArg> RefArg for (A, B, C, D, E, F)[src]

impl<A: RefArg, B: RefArg, C: RefArg, D: RefArg, E: RefArg, F: RefArg, G: RefArg> RefArg for (A, B, C, D, E, F, G)[src]

impl<A: RefArg, B: RefArg, C: RefArg, D: RefArg, E: RefArg, F: RefArg, G: RefArg, H: RefArg> RefArg for (A, B, C, D, E, F, G, H)[src]

impl<A: RefArg, B: RefArg, C: RefArg, D: RefArg, E: RefArg, F: RefArg, G: RefArg, H: RefArg, I: RefArg> RefArg for (A, B, C, D, E, F, G, H, I)[src]

impl<A: RefArg, B: RefArg, C: RefArg, D: RefArg, E: RefArg, F: RefArg, G: RefArg, H: RefArg, I: RefArg, J: RefArg> RefArg for (A, B, C, D, E, F, G, H, I, J)[src]

impl<A: RefArg, B: RefArg, C: RefArg, D: RefArg, E: RefArg, F: RefArg, G: RefArg, H: RefArg, I: RefArg, J: RefArg, K: RefArg> RefArg for (A, B, C, D, E, F, G, H, I, J, K)[src]

impl<A: RefArg, B: RefArg, C: RefArg, D: RefArg, E: RefArg, F: RefArg, G: RefArg, H: RefArg, I: RefArg, J: RefArg, K: RefArg, L: RefArg> RefArg for (A, B, C, D, E, F, G, H, I, J, K, L)[src]

impl RefArg for VecDeque<Box<dyn RefArg>>[src]

impl<'a, T: Arg + RefArg> RefArg for &'a [T][src]

impl<T: Arg + RefArg> RefArg for Vec<T>[src]

impl<K: DictKey + RefArg + Eq + Hash, V: RefArg + Arg, S: BuildHasher + Send + Sync> RefArg for HashMap<K, V, S>[src]

Loading content...

Implementors

impl RefArg for MessageItem[src]

impl RefArg for OwnedFd[src]

impl RefArg for ErrorName<'static>[src]

impl RefArg for Interface<'static>[src]

impl RefArg for Member<'static>[src]

impl RefArg for Path<'static>[src]

impl RefArg for Signature<'static>[src]

impl<'a, T, I> RefArg for Array<'static, T, I> where
    T: 'a + Arg + RefArg,
    I: Debug + Clone + Send + Sync + Iterator<Item = &'a T>, 
[src]

impl<T: RefArg> RefArg for Variant<T>[src]

Loading content...