Struct psup_impl::Worker[][src]

pub struct Worker<H, F> where
    H: Fn(UnixStream, String) -> F,
    F: Future<Output = Result<()>>, 
{ /* fields omitted */ }

Worker process handler.

Implementations

impl<H, F> Worker<H, F> where
    H: Fn(UnixStream, String) -> F,
    F: Future<Output = Result<()>>, 
[src]

pub fn new() -> Self[src]

Create a new worker.

pub fn relaxed(self, flag: bool) -> Self[src]

Set the relaxed flag.

When a worker is relaxed it will start with or without a supervisor.

The default is false so workers expect to be run in the context of a supervisor and it is an error if no worker id is available in the environment.

When this flag is enabled and the required environment variables do not exist the worker does not attempt to connect to a supervisor.

Use this mode of operation when a worker process can be run standalone or as a worker for a supervisor process.

pub fn client(self, handler: H) -> Self[src]

Set a client connection handler.

The handler function receives the socket stream and opaque worker identifier and can communicate with the supervisor using the socket stream.

pub async fn run(&self) -> Result<()>[src]

Start this worker running.

Auto Trait Implementations

impl<H, F> RefUnwindSafe for Worker<H, F> where
    H: RefUnwindSafe

impl<H, F> Send for Worker<H, F> where
    H: Send

impl<H, F> Sync for Worker<H, F> where
    H: Sync

impl<H, F> Unpin for Worker<H, F> where
    H: Unpin

impl<H, F> UnwindSafe for Worker<H, F> where
    H: UnwindSafe

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, 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<V, T> VZip<V> for T where
    V: MultiLane<T>,