Struct omnisensor::dbus_helpers::SignalProp
source · [−]pub struct SignalProp<A> {
data: A,
msgfn: Arc<dyn Fn(&Path<'_>, &dyn RefArg) -> Option<Message> + Send + Sync>,
dbuspath: Arc<SensorPath>,
conn: Arc<SyncConnection>,
}
Expand description
A dbus property that owns its own data and automatically sends property-change signals on updates.
Fields
data: A
The current value of the property.
msgfn: Arc<dyn Fn(&Path<'_>, &dyn RefArg) -> Option<Message> + Send + Sync>
A function to create a PropetiesChanged
signal message when data
changes.
dbuspath: Arc<SensorPath>
The dbus path of the object this property belongs to.
conn: Arc<SyncConnection>
The dbus connection via which PropetiesChanged
signals are sent.
Implementations
sourceimpl<A: PartialEq + RefArg> SignalProp<A>
impl<A: PartialEq + RefArg> SignalProp<A>
sourcepub fn new(
data: A,
msgfn: &Arc<dyn Fn(&Path<'_>, &dyn RefArg) -> Option<Message> + Send + Sync>,
dbuspath: &Arc<SensorPath>,
conn: &Arc<SyncConnection>
) -> Self
pub fn new(
data: A,
msgfn: &Arc<dyn Fn(&Path<'_>, &dyn RefArg) -> Option<Message> + Send + Sync>,
dbuspath: &Arc<SensorPath>,
conn: &Arc<SyncConnection>
) -> Self
Construct a SignalProp
with the given members.
sourcepub fn set(&mut self, newdata: A)
pub fn set(&mut self, newdata: A)
Update self
’s value to newdata
, emitting a PropertiesChanged
signal to dbus if newdata
is unequal to self.data
’s previous
value.
sourcefn send_propchg(&self)
fn send_propchg(&self)
Emit a PropertiesChanged
signal to dbus with self
’s current value.
Auto Trait Implementations
impl<A> !RefUnwindSafe for SignalProp<A>
impl<A> Send for SignalProp<A>where
A: Send,
impl<A> Sync for SignalProp<A>where
A: Sync,
impl<A> Unpin for SignalProp<A>where
A: Unpin,
impl<A> !UnwindSafe for SignalProp<A>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more