Struct dbus_crossroads::PropBuilder
source · [−]pub struct PropBuilder<'a, T: 'static, A: 'static> { /* private fields */ }
Expand description
Struct used to describe a property when building an interface.
Implementations
sourceimpl<T: Send, A: Send + RefArg + Arg + Append> PropBuilder<'_, T, A>
impl<T: Send, A: Send + RefArg + Arg + Append> PropBuilder<'_, T, A>
pub fn get<CB>(self, cb: CB) -> Selfwhere
CB: FnMut(&mut PropContext, &mut T) -> Result<A, MethodErr> + Send + 'static,
pub fn get_with_cr<CB>(self, cb: CB) -> Selfwhere
CB: FnMut(&mut PropContext, &mut Crossroads) -> Result<A, MethodErr> + Send + 'static,
pub fn get_with_cr_async<R, CB>(self, cb: CB) -> Selfwhere
CB: FnMut(PropContext, &mut Crossroads) -> R + Send + 'static,
R: Future<Output = PhantomData<A>> + Send + 'static,
pub fn get_async<R, CB>(self, cb: CB) -> Selfwhere
CB: FnMut(PropContext, &mut T) -> R + Send + 'static,
R: Future<Output = PhantomData<A>> + Send + 'static,
sourcepub fn changed_msg_fn(
self
) -> Box<dyn Fn(&Path<'_>, &dyn RefArg) -> Option<Message> + Send + Sync + 'static>
pub fn changed_msg_fn(
self
) -> Box<dyn Fn(&Path<'_>, &dyn RefArg) -> Option<Message> + Send + Sync + 'static>
Returns a function which, when called, creates a PropertiesChanged message.
Call the resulting function with the path that the object belongs to, and a reference to the new value. If a PropertiesChanged message should be sent (this depends on the emits_changed function called), such a message will be returned.
Panics
If emits_changed is set to “const”, the function will panic.
sourceimpl<T: Send, A: RefArg + Send + for<'x> Get<'x> + Arg + Append> PropBuilder<'_, T, A>
impl<T: Send, A: RefArg + Send + for<'x> Get<'x> + Arg + Append> PropBuilder<'_, T, A>
sourcepub fn set<CB>(self, cb: CB) -> Selfwhere
CB: FnMut(&mut PropContext, &mut T, A) -> Result<Option<A>, MethodErr> + Send + 'static,
pub fn set<CB>(self, cb: CB) -> Selfwhere
CB: FnMut(&mut PropContext, &mut T, A) -> Result<Option<A>, MethodErr> + Send + 'static,
Adds a set property handler to this property.
In case an EmitsChangedSignal should be emitted, the callback should return Ok(Some(v)) where v is the value to be emitted. If no EmitsChangedSignal should be emitted, return Ok(None).
sourcepub fn set_with_cr<CB>(self, cb: CB) -> Selfwhere
CB: FnMut(&mut PropContext, &mut Crossroads, A) -> Result<Option<A>, MethodErr> + Send + 'static,
pub fn set_with_cr<CB>(self, cb: CB) -> Selfwhere
CB: FnMut(&mut PropContext, &mut Crossroads, A) -> Result<Option<A>, MethodErr> + Send + 'static,
Adds a set property handler to this property, and allowing the entire tree to be changed.
In case an EmitsChangedSignal should be emitted, the callback should return Ok(Some(v)) where v is the value to be emitted. If no EmitsChangedSignal should be emitted, return Ok(None).
pub fn set_custom<CB>(self, cb: CB) -> Selfwhere
CB: FnMut(PropContext, &mut Crossroads, A) -> Option<PropContext> + Send + 'static,
pub fn set_with_cr_async<CB, R>(self, cb: CB) -> Selfwhere
CB: FnMut(PropContext, &mut Crossroads, A) -> R + Send + 'static,
R: Future<Output = PhantomData<Option<A>>> + Send + 'static,
pub fn set_async<CB, R>(self, cb: CB) -> Selfwhere
CB: FnMut(PropContext, &mut T, A) -> R + Send + 'static,
R: Future<Output = PhantomData<Option<A>>> + Send + 'static,
sourceimpl<T: Send, A> PropBuilder<'_, T, A>
impl<T: Send, A> PropBuilder<'_, T, A>
pub fn annotate<N: Into<String>, V: Into<String>>(self, name: N, value: V) -> Self
pub fn deprecated(self) -> Self
pub fn emits_changed_false(self) -> Self
sourcepub fn emits_changed_const(self) -> Self
pub fn emits_changed_const(self) -> Self
This means that the property never changes. Attempts to change it or make an “PropertiesChanged” signal will result in a panic.