Struct transition::Notifier [−][src]
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
Auto Trait Implementations
impl !RefUnwindSafe for Notifier
[src]
impl Send for Notifier
[src]
impl Sync for Notifier
[src]
impl Unpin for Notifier
[src]
impl !UnwindSafe for Notifier
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,