Skip to main content

DeviceEventCallbacks

Struct DeviceEventCallbacks 

Source
pub struct DeviceEventCallbacks { /* private fields */ }
Expand description

A structure holding the callbacks for device change notifications

Implementations§

Source§

impl DeviceEventCallbacks

Source

pub fn new() -> Self

Create a new DeviceEventCallbacks with no callbacks set

Source

pub fn set_device_state_callback( &mut self, c: impl Fn(String, DeviceState) + 'static + Sync + Send, )

Set a callback for OnDeviceStateChanged notifications. The parameters are the device id and the new state.

Source

pub fn unset_device_state_callback(&mut self)

Remove a callback for OnDeviceStateChanged notifications

Source

pub fn set_device_added_callback( &mut self, c: impl Fn(String) + 'static + Sync + Send, )

Set a callback for OnDeviceAdded notifications. The parameter is the device id.

Source

pub fn unset_device_added_callback(&mut self)

Remove a callback for OnDeviceAdded notifications

Source

pub fn set_device_removed_callback( &mut self, c: impl Fn(String) + 'static + Sync + Send, )

Set a callback for OnDeviceRemoved notifications. The parameter is the device id.

Source

pub fn unset_device_removed_callback(&mut self)

Remove a callback for OnDeviceRemoved notifications

Source

pub fn set_default_device_callback( &mut self, c: impl Fn(Direction, Role, Option<String>) + 'static + Sync + Send, )

Set a callback for OnDefaultDeviceChanged notifications. The parameters are the direction and role of the new default device, and its device id. The id is None when there is no longer a default device for that direction and role.

Source

pub fn unset_default_device_callback(&mut self)

Remove a callback for OnDefaultDeviceChanged notifications

Source

pub fn set_property_value_callback( &mut self, c: impl Fn(String, PROPERTYKEY) + 'static + Sync + Send, )

Set a callback for OnPropertyValueChanged notifications. The parameters are the device id and the key of the changed property.

Source

pub fn unset_property_value_callback(&mut self)

Remove a callback for OnPropertyValueChanged notifications

Trait Implementations§

Source§

impl Default for DeviceEventCallbacks

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.