[][src]Struct lightproc::proc_stack::ProcStack

pub struct ProcStack {
    pub pid: AtomicUsize,
    // some fields omitted
}

Stack abstraction for lightweight processes

Example

use lightproc::proc_stack::ProcStack;

ProcStack::default()
    .with_before_start(|| { println!("Before start"); })
    .with_after_complete(|| { println!("After complete"); })
    .with_after_panic(|| { println!("After panic"); });

Fields

pid: AtomicUsize

Process ID for the Lightweight Process

Can be used to identify specific processes during any executor, reactor implementations.

Methods

impl ProcStack[src]

pub fn with_pid(self, pid: usize) -> Self[src]

Adds pid for the process which is going to take this stack

use lightproc::proc_stack::ProcStack;

ProcStack::default()
    .with_pid(1);

pub fn with_before_start<T>(self, callback: T) -> Self where
    T: Fn() + Send + Sync + 'static, 
[src]

Adds a callback that will be executed before polling inner future to the stack

use lightproc::proc_stack::ProcStack;

ProcStack::default()
    .with_before_start(|| { println!("Before start") });

pub fn with_after_complete<T>(self, callback: T) -> Self where
    T: Fn() + Send + Sync + 'static, 
[src]

Adds a callback that will be executed after inner future resolves to an output to the stack

use lightproc::proc_stack::ProcStack;

ProcStack::default()
    .with_after_complete(|| { println!("After complete") });

pub fn with_after_panic<T>(self, callback: T) -> Self where
    T: Fn() + Send + Sync + 'static, 
[src]

Adds a callback that will be executed after inner future panics to the stack

use lightproc::proc_stack::ProcStack;

ProcStack::default()
    .with_after_panic(|| { println!("After panic") });

pub fn get_pid(&self) -> usize[src]

Utility function to get_pid for the implementation of executors.

use lightproc::proc_stack::ProcStack;

let proc = ProcStack::default().with_pid(123);

assert_eq!(proc.get_pid(), 123);

Trait Implementations

impl Clone for ProcStack[src]

impl Default for ProcStack[src]

impl Debug for ProcStack[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<T> 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<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.

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

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

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