Struct transition::Notifier[][src]

pub struct Notifier { /* fields omitted */ }

Allows to control blinking of the LED after the transition starts.

After you starts the blinking via start(), you can end the blinking process via this struct.

Example

use transition::{Transition, Notifier, Led};

let notifier: Notifier = Transition::new(&[Led::Blue, Led::Blank])?.start()?;
// blinks using color blue
thread::sleep(Duration::from_secs(1));
notifier.notify_failure();

Implementations

impl Notifier[src]

pub fn notify_success(self) -> Result<(), TransitionErr>[src]

Finishes the transition with success.

Changes the color of the LED, to the one set with on_success. If not set, the default is set to green.

Stops the thread which is responsible for blinking of the LED.

Example

use transition::{Transition, Notifier, Led};

let notifier: Notifier = Transition::new(&[Led::Blue, Led::Blank])?.start()?;
// blinks using color blue
thread::sleep(Duration::from_secs(1));
notifier.notify_success();

Errors

This method sends message to blinking thread using crossbeam channel. If any error related with sending this message will occur, then this method returns TransitionErr.

pub fn notify_failure(self) -> Result<(), TransitionErr>[src]

Finishes the transition with failure.

Changes the color of the LED, to the one set with on_failure. If not set, the default is set to red.

Stops the thread which is responsible for blinking of the LED.

Example

use transition::{Transition, Notifier, Led};

let notifier: Notifier = Transition::new(&[Led::Blue, Led::Blank])?.start()?;
// blinks using color blue
thread::sleep(Duration::from_secs(1));
notifier.notify_failure();

Errors

This method sends message to blinking thread using crossbeam channel. If any error related with sending this message will occur, then this method returns TransitionErr.

Trait Implementations

impl Debug for Notifier[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.