Struct FeedbackManager

Source
pub struct FeedbackManager { /* private fields */ }

Implementations§

Source§

impl FeedbackManager

Source

pub fn new() -> Self

Source

pub fn trigger(&self)

Examples found in repository?
examples/basic.rs (line 9)
5fn main() {
6    let haptic_manager = FeedbackManager::default();
7    loop {
8        // Shortest possible
9        haptic_manager.trigger();
10        thread::sleep(Duration::from_secs(1));
11
12        // 1 second of continuous feedback
13        let length_millis = 1000;
14        let delay_millis = 1000;
15        haptic_manager.trigger_with_feedback(
16            Feedback::new(length_millis, delay_millis)
17        );
18    }
19}
Source

pub fn trigger_with_delay(&self, delay_millis: u64)

Source

pub fn trigger_with_feedback(&self, feedback: Feedback)

Examples found in repository?
examples/basic.rs (lines 15-17)
5fn main() {
6    let haptic_manager = FeedbackManager::default();
7    loop {
8        // Shortest possible
9        haptic_manager.trigger();
10        thread::sleep(Duration::from_secs(1));
11
12        // 1 second of continuous feedback
13        let length_millis = 1000;
14        let delay_millis = 1000;
15        haptic_manager.trigger_with_feedback(
16            Feedback::new(length_millis, delay_millis)
17        );
18    }
19}
More examples
Hide additional examples
examples/morse.rs (lines 121-123)
112    fn play(&self, symbol: Morse) {
113        println!("{}", symbol);
114        let delay: u64 = 200;
115        match symbol {
116            Morse::Space => {
117                sleep(Duration::from_millis(symbol.get_millis() + delay))
118            }
119
120            Morse::Dot => {
121                self.trigger_with_feedback(Feedback::new(
122                    symbol.get_millis(), delay
123                ));
124            }
125            Morse::Dash => {
126                self.trigger_with_feedback(Feedback::new(
127                    symbol.get_millis(), delay * 2
128                ));
129            }
130        }
131    }

Trait Implementations§

Source§

impl Default for FeedbackManager

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.
Source§

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