[][src]Struct hap::characteristic::Characteristic

pub struct Characteristic<T: Debug + Default + Clone + Serialize + Send + Sync> { /* fields omitted */ }

A characteristic. A characteristic is a feature that represents data or an associated behavior of a service. The characteristic is defined by a universally unique type, and has additional properties that determine how the value of the characteristic can be accessed.

Implementations

impl<T: Debug + Default + Clone + Serialize + Send + Sync> Characteristic<T> where
    T: Deserialize<'de>, 
[src]

pub fn get_id(&self) -> u64[src]

Returns the ID of a Characteristic.

pub fn get_type(&self) -> HapType[src]

Returns the HapType of a Characteristic.

pub fn get_format(&self) -> Format[src]

Returns the Format of a Characteristic.

pub fn get_perms(&self) -> Vec<Perm>[src]

Returns the Perms of a Characteristic.

pub fn set_description(&mut self, description: Option<String>)[src]

Sets the description of a Characteristic.

pub fn get_event_notifications(&self) -> Option<bool>[src]

Returns the event notifications value of a Characteristic.

pub fn set_event_notifications(&mut self, event_notifications: Option<bool>)[src]

Sets the event notifications value of a Characteristic.

pub async fn get_value<'_>(&'_ mut self) -> Result<T>[src]

Returns the value of a Characteristic.

pub async fn set_value<'_>(&'_ mut self, val: T) -> Result<()>[src]

Sets the value of a Characteristic.

pub fn get_unit(&self) -> Option<Unit>[src]

Returns the Unit of a Characteristic.

pub fn get_max_value(&self) -> Option<T>[src]

Returns the maximum value of a Characteristic.

pub fn set_max_value(&mut self, val: Option<T>)[src]

Sets the maximum value of a Characteristic.

pub fn get_min_value(&self) -> Option<T>[src]

Returns the minimum value of a Characteristic.

pub fn set_min_value(&mut self, val: Option<T>)[src]

Sets the minimum value of a Characteristic.

pub fn get_step_value(&self) -> Option<T>[src]

Returns the step value of a Characteristic.

pub fn set_step_value(&mut self, val: Option<T>)[src]

Returns the step value of a Characteristic.

pub fn get_max_len(&self) -> Option<u16>[src]

Returns the maximum length of a Characteristic.

pub fn on_read(&mut self, f: Option<impl OnReadFn<T>>)[src]

Sets a callback function on a characteristic that is called every time a controller attempts to read its value. Returning a Some(T) from this function changes the value of the Characteristic before the Controller reads it so the Controller reads the new value.

pub fn on_update(&mut self, f: Option<impl OnUpdateFn<T>>)[src]

Sets a callback function on a characteristic that is called every time a controller attempts to update its value. The first argument is a reference to the current value of the characteristic and the second argument is a reference to the value the controller attempts to change the characteristic's to.

pub fn on_read_async(&mut self, f: Option<impl OnReadFuture<T>>)[src]

Sets an async callback function on a characteristic that is driven to completion by the async runtime driving the HAP server every time a controller attempts to read its value. Returning a Some(T) from this function changes the value of the characteristic before the controller reads it so the controller reads the new value.

pub fn on_update_async(&mut self, f: Option<impl OnUpdateFuture<T>>)[src]

Sets an async callback function on a characteristic that is driven to completion by the async runtime driving the HAP server every time a controller attempts to update its value. The first argument is a reference to the current value of the characteristic and the second argument is a reference to the value the controller attempts to change the characteristic's to.

Trait Implementations

impl<T: Debug + Default + Clone + Serialize + Send + Sync> Debug for Characteristic<T>[src]

impl<T: Default + Debug + Clone + Serialize + Send + Sync> Default for Characteristic<T>[src]

impl<T: Debug + Default + Clone + Serialize + Send + Sync> Serialize for Characteristic<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Characteristic<T>

impl<T> Send for Characteristic<T>

impl<T> Sync for Characteristic<T>

impl<T> Unpin for Characteristic<T> where
    T: Unpin

impl<T> !UnwindSafe for Characteristic<T>

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> Instrument for T[src]

impl<T> Instrument for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Serialize for T where
    T: Serialize + ?Sized
[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,