Struct transition::Transition[][src]

pub struct Transition { /* fields omitted */ }

Main structure. Represents colors of task state (pending, successfull, failed). Allows to start the transition.

Implementations

impl Transition[src]

pub fn new(colors: &[Led]) -> Result<Self, TransitionErr>[src]

Creates new instance of Transition with specified colors for "pending" state.

Passed colors will be used between calls of start and notify_success (or notify_failure) to visualise pendig task execution. The failure color is set to red and the success color is set to green. You can override success and failure colors using on_success and on_failure accordingly.

Example

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

let transition = Transition::new(&[Led::Blue, Led::Blank]);

Errors

If there will be issue with connecting to blink(1) device, an error variant will be returned.

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

Starts the transition.

The transition is started in a separate thread. As a result, you get Notifier struct.

Example

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

let notifier = Transition::new(&[Led::Blue, Led::Blank])?.start()?;

Errors

If any error related to Blink(1) device will be thrown, this method results with TransitionErr.

#[must_use]pub fn on_success(self, color: &Led) -> Self[src]

Allows to override success color.

Example

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

let transition = Transition::default().on_success(&Led::Orange);

#[must_use]pub fn on_failure(self, color: &Led) -> Self[src]

Allows to override failure color.

Example

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

let transition = Transition::default().on_failure(&Led::Cyan);

Trait Implementations

impl Clone for Transition[src]

impl Debug for Transition[src]

impl Default for Transition[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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.