Skip to main content

Supervisor

Struct Supervisor 

Source
pub struct Supervisor {
    pub spec: Spec,
    /* private fields */
}
Expand description

One plugin, kept running.

Fields§

§spec: Spec

Implementations§

Source§

impl Supervisor

Source

pub fn new( spec: Spec, ctx: Context, max_restarts: u32, grant: impl FnMut(&Hello) -> Grants + Send + 'static, ) -> Self

max_restarts is the plugins.max_restarts preference.

Source

pub fn with_restarts( spec: Spec, ctx: Context, restarts: Restarts, grant: impl FnMut(&Hello) -> Grants + Send + 'static, ) -> Self

Source

pub fn with_notify( spec: Spec, ctx: Context, restarts: Restarts, notify: Notify, grant: impl FnMut(&Hello) -> Grants + Send + 'static, ) -> Self

Like Supervisor::new, with a callback for arriving messages; it is set before the first start.

Source

pub fn set_ctx(&mut self, ctx: Context)

Send the new drawing area to later restarts too.

Source

pub fn state(&self) -> &State

Source

pub fn connection(&self) -> Option<&Connection>

Source

pub fn send(&mut self, m: &In, now: Instant) -> bool

Send a message; a broken pipe counts as a crash.

Source

pub fn poll(&mut self, now: Instant) -> Vec<Out>

Drain the plugin’s messages and handle crashes and restarts. Call it every frame or when woken. StateSave is kept here for the restart.

Source

pub fn restart(&mut self, now: Instant)

The status bar’s restart action: count again from zero and start now.

Source

pub fn stop(&mut self, reason: &str)

Stop for good (quit, disable, upgrade).

Source

pub fn status(&self, now: Instant) -> Option<String>

A status-bar line, or None while it runs normally.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.