pub struct AsyncStreamDeck { /* private fields */ }
Available on crate feature async only.
Expand description

Stream Deck interface suitable to be used in async, uses block_in_place so this wrapper cannot be used in current_thread runtimes

Implementations§

source§

impl AsyncStreamDeck

Static functions of the struct

source

pub fn connect( hidapi: &HidApi, kind: Kind, serial: &str ) -> Result<AsyncStreamDeck, StreamDeckError>

Attempts to connect to the device, can be safely ran inside multi_thread runtime

source§

impl AsyncStreamDeck

Instance methods of the struct

source

pub fn kind(&self) -> Kind

Returns kind of the Stream Deck

source

pub async fn manufacturer(&self) -> Result<String, StreamDeckError>

Returns manufacturer string of the device

source

pub async fn product(&self) -> Result<String, StreamDeckError>

Returns product string of the device

source

pub async fn serial_number(&self) -> Result<String, StreamDeckError>

Returns serial number of the device

source

pub async fn firmware_version(&self) -> Result<String, StreamDeckError>

Returns firmware version of the StreamDeck

source

pub async fn read_input( &self, poll_rate: f32 ) -> Result<StreamDeckInput, StreamDeckError>

Reads button states, awaits until there’s data. Poll rate determines how often button state gets checked

source

pub fn get_reader(&self) -> Arc<DeviceStateReader>

Returns button state reader for this device

source

pub async fn reset(&self) -> Result<(), StreamDeckError>

Resets the device

source

pub async fn set_brightness(&self, percent: u8) -> Result<(), StreamDeckError>

Sets brightness of the device, value range is 0 - 100

source

pub async fn write_image( &self, key: u8, image_data: &[u8] ) -> Result<(), StreamDeckError>

Writes image data to Stream Deck device, needs to accept Arc for image data since it runs a blocking thread under the hood

source

pub async fn write_lcd( &self, x: u16, y: u16, rect: Arc<ImageRect> ) -> Result<(), StreamDeckError>

Writes image data to Stream Deck device’s lcd strip/screen, needs to accept Arc for image data since it runs a blocking thread under the hood

source

pub async fn clear_button_image(&self, key: u8) -> Result<(), StreamDeckError>

Writes image data to Stream Deck device

source

pub async fn set_button_image( &self, key: u8, image: DynamicImage ) -> Result<(), StreamDeckError>

Sets specified button’s image

Trait Implementations§

source§

impl Clone for AsyncStreamDeck

source§

fn clone(&self) -> AsyncStreamDeck

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.