Struct transition::Transition [−][src]
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]
fn clone(&self) -> Transition
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Transition
[src]
impl Default for Transition
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Transition
[src]
impl Send for Transition
[src]
impl Sync for Transition
[src]
impl Unpin for Transition
[src]
impl !UnwindSafe for Transition
[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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,