[][src]Struct dbus_tree::Property

pub struct Property<M: MethodType<D>, D: DataType> { /* fields omitted */ }

A D-Bus Property.

Implementations

impl<M: MethodType<D>, D: DataType> Property<M, D>[src]

pub fn emits_changed(self, e: EmitsChangedSignal) -> Self[src]

Builder method that allows setting the Property's signal behavior when changed.

Note: if e is set to const, the property will be read only.

pub fn auto_emit_on_set(self, b: bool) -> Self[src]

Builder method that determines whether or not setting this property will result in an PropertiesChanged signal. Defaults to true.

When set to true (the default), the behaviour is determined by "emits_changed". When set to false, no PropertiesChanged signal will be emitted (but the signal still shows up in introspection data). You can still emit the signal manually by, e g, calling add_propertieschanged and send the resulting message(s).

pub fn access(self, e: Access) -> Self[src]

Builder method that allows setting the Property as readable, writable, or both.

Note: might modify emits_changed as well, if property is changed to non-readonly and emit is set to "Const".

pub fn annotate<N: Into<String>, V: Into<String>>(
    self,
    name: N,
    value: V
) -> Self
[src]

Builder method that adds an annotation to the method.

pub fn deprecated(self) -> Self[src]

Builder method that adds an annotation that this entity is deprecated.

pub fn get_name(&self) -> &str[src]

Get property name

pub fn get_data(&self) -> &D::Property[src]

Get associated data

pub fn can_get(&self) -> Result<(), MethodErr>[src]

Returns Ok if the property is gettable

pub fn get_as_variant(
    &self,
    i: &mut IterAppend<'_>,
    pinfo: &PropInfo<'_, M, D>
) -> Result<(), MethodErr>
[src]

Calls the on_get function and appends the result as a variant.

Note: Will panic if get_cb is not set.

pub fn can_set(&self, i: Option<Iter<'_>>) -> Result<(), MethodErr>[src]

Returns Ok if the property is settable.

Will verify signature in case iter is not None; iter is supposed to point at the Variant with the item inside.

pub fn set_as_variant(
    &self,
    i: &mut Iter<'_>,
    pinfo: &PropInfo<'_, M, D>
) -> Result<Option<Message>, MethodErr>
[src]

Calls the on_set function, which reads from i.

The return value might contain an extra message containing the EmitsChanged signal. Note: Will panic if set_cb is not set.

pub fn add_propertieschanged<F: FnOnce() -> Box<dyn RefArg>>(
    &self,
    v: &mut Vec<PropertiesPropertiesChanged>,
    iface: &IfaceName<'_>,
    new_value: F
)
[src]

Adds this property to a list of PropertiesChanged signals.

"v" is updated with the signal for this property. "new_value" is only called if self.emits is "true", it should return the value of the property. If no PropertiesChanged signal should be emitted for this property, "v" is left unchanged.

impl<'a, D: DataType> Property<MTFn<D>, D>[src]

pub fn on_get<H>(self, handler: H) -> Property<MTFn<D>, D> where
    H: 'static + Fn(&mut IterAppend<'_>, &PropInfo<'_, MTFn<D>, D>) -> Result<(), MethodErr>, 
[src]

Sets the callback for getting a property.

For single-thread use.

pub fn on_set<H>(self, handler: H) -> Property<MTFn<D>, D> where
    H: 'static + Fn(&mut Iter<'_>, &PropInfo<'_, MTFn<D>, D>) -> Result<(), MethodErr>, 
[src]

Sets the callback for setting a property.

For single-thread use.

impl<'a, D: DataType> Property<MTFnMut<D>, D>[src]

pub fn on_get<H>(self, handler: H) -> Property<MTFnMut<D>, D> where
    H: 'static + Fn(&mut IterAppend<'_>, &PropInfo<'_, MTFnMut<D>, D>) -> Result<(), MethodErr>, 
[src]

Sets the callback for getting a property.

For single-thread use.

pub fn on_set<H>(self, handler: H) -> Property<MTFnMut<D>, D> where
    H: 'static + Fn(&mut Iter<'_>, &PropInfo<'_, MTFnMut<D>, D>) -> Result<(), MethodErr>, 
[src]

Sets the callback for setting a property.

For single-thread use.

impl<D: DataType> Property<MTSync<D>, D>[src]

pub fn on_get<H>(self, handler: H) -> Property<MTSync<D>, D> where
    H: Fn(&mut IterAppend<'_>, &PropInfo<'_, MTSync<D>, D>) -> Result<(), MethodErr> + Send + Sync + 'static, 
[src]

Sets the callback for getting a property.

For multi-thread use.

pub fn on_set<H>(self, handler: H) -> Property<MTSync<D>, D> where
    H: Fn(&mut Iter<'_>, &PropInfo<'_, MTSync<D>, D>) -> Result<(), MethodErr> + Send + Sync + 'static, 
[src]

Sets the callback for setting a property.

For single-thread use.

impl<M: MethodType<D>, D: DataType> Property<M, D> where
    D::Property: Append + Clone
[src]

pub fn default_get(self) -> Self[src]

Adds a "standard" get handler.

impl<M: MethodType<D>, D: DataType> Property<M, D> where
    D::Property: RefArg
[src]

pub fn default_get_refarg(self) -> Self[src]

Adds a "standard" get handler (for RefArgs).

Trait Implementations

impl<M: Debug + MethodType<D>, D: Debug + DataType> Debug for Property<M, D> where
    D::Property: Debug
[src]

Auto Trait Implementations

impl<M, D> RefUnwindSafe for Property<M, D> where
    <M as MethodType<D>>::GetProp: RefUnwindSafe,
    <D as DataType>::Property: RefUnwindSafe,
    <M as MethodType<D>>::SetProp: RefUnwindSafe

impl<M, D> Send for Property<M, D> where
    <M as MethodType<D>>::GetProp: Send,
    <D as DataType>::Property: Send,
    <M as MethodType<D>>::SetProp: Send

impl<M, D> Sync for Property<M, D> where
    <M as MethodType<D>>::GetProp: Sync,
    <D as DataType>::Property: Sync,
    <M as MethodType<D>>::SetProp: Sync

impl<M, D> Unpin for Property<M, D> where
    <D as DataType>::Property: Unpin

impl<M, D> UnwindSafe for Property<M, D> where
    <M as MethodType<D>>::GetProp: UnwindSafe,
    <D as DataType>::Property: UnwindSafe,
    <M as MethodType<D>>::SetProp: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.