[][src]Struct joycon_rs::joycon::SimpleJoyConDriver

pub struct SimpleJoyConDriver {
    pub joycon: Arc<Mutex<JoyConDevice>>,
    pub rotation: Rotation,
    // some fields omitted
}

The controller user uses to play with. If you're not happy with this implementation, you can use JoyConDriver trait.

Examples

use joycon_rs::prelude::{JoyConManager, SimpleJoyConDriver, lights::*};
use joycon_rs::result::JoyConResult;

let manager = JoyConManager::get_instance();

let devices = {
    let lock = manager.lock();
    match lock {
        Ok(manager) => manager.new_devices(),
        Err(_) => return,
    }
};

devices.iter()
    .try_for_each::<_,JoyConResult<()>>(|device| {
        let mut driver = SimpleJoyConDriver::new(&device)?;

        // set player's lights
        driver.set_player_lights(&vec![SimpleJoyConDriver::LIGHT_UP[0]], &vec![])?;

        Ok(())
    })
    .unwrap();

Fields

joycon: Arc<Mutex<JoyConDevice>>

The controller user uses

rotation: Rotation

rotation of controller

Implementations

impl SimpleJoyConDriver[src]

pub fn new(joycon: &Arc<Mutex<JoyConDevice>>) -> JoyConResult<Self>[src]

Constructs a new SimpleJoyConDriver.

pub fn joycon(&self) -> MutexGuard<JoyConDevice>[src]

Trait Implementations

impl Debug for SimpleJoyConDriver[src]

impl JoyConDriver for SimpleJoyConDriver[src]

Auto Trait Implementations

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, U> Into<U> for T where
    U: From<T>, 
[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.