[][src]Struct oqueue::Task

pub struct Task {
    pub index: usize,
    // some fields omitted
}

Unit of work arranged by a Sequencer.

Use the standard library write! or writeln! macros for writing the output of a task. Additionally this type provides some methods for setting the color of task output.

Refer to the crate-level documentation and the documentation of the Sequencer type for the recommended patterns of launching tasks.

use oqueue::{Color::Blue, Task};

fn work(task: Task) {
    task.color(Blue);
    writeln!(task, "hello from task #{}", task.index);
}

Fields

index: usize

Index of the current task. This is a sequential counter that begins at 0 and increments by 1 for each successively started task. It may be helpful in determining what work this task is responsible for performing.

This field is read-only; writing to its value will not compile.

Methods

impl Task[src]

pub fn bold(&self)[src]

Set output to appear in bold uncolored.

pub fn color(&self, color: Color)[src]

Set output to appear in color (not bold).

pub fn bold_color(&self, color: Color)[src]

Set output to appear bold and colored.

pub fn reset_color(&self)[src]

Set output to non-bold uncolored.

Trait Implementations

impl Clone for Task[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Task[src]

impl Write for Task[src]

fn write_vectored(&mut self, bufs: &[IoVec]) -> Result<usize, Error>[src]

🔬 This is a nightly-only experimental API. (iovec)

Like write, except that it writes from a slice of buffers. Read more

fn by_ref(&mut self) -> &mut Self
1.0.0
[src]

Creates a "by reference" adaptor for this instance of Write. Read more

impl WriteColor for Task[src]

fn is_synchronous(&self) -> bool[src]

Returns true if and only if the underlying writer must synchronously interact with an end user's device in order to control colors. By default, this always returns false. Read more

Auto Trait Implementations

impl !Send for Task

impl !Sync for Task

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]