Skip to main content

Workers

Struct Workers 

Source
pub struct Workers { /* private fields */ }
Expand description

The workers this process is keeping alive, one lane per environment.

A lane is locked for the length of an exchange, so calls into one worker queue up — which they must, since two messages down one pipe have no way to be told apart. Different environments do not wait on each other.

Implementations§

Source§

impl Workers

Source

pub fn new() -> Self

A pool holding nothing yet.

Source

pub async fn invoke( &self, ws: &CheckedWorkspace, environment: &Environment, implementation: &Implementation, args: Vec<Value>, params: &[Type], expected: &Type, ) -> Result<Value, ExecError>

Runs an implementation on the worker for its environment, starting one if there is not already one running.

Source

pub async fn shutdown(&self)

Stops every worker.

Dropping the pool does this too, since each child is killed with its handle; this is for stopping them at a moment of your choosing.

Source

pub async fn running(&self) -> usize

How many workers are running.

Trait Implementations§

Source§

impl Default for Workers

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for Workers

§

impl !RefUnwindSafe for Workers

§

impl !UnwindSafe for Workers

§

impl Forget for Workers

§

impl Move for Workers

§

impl Send for Workers
where Mutex<HashMap<Ident, Arc<Mutex<Option<Worker>>>>>: Send,

§

impl Sync for Workers
where Mutex<HashMap<Ident, Arc<Mutex<Option<Worker>>>>>: Sync,

§

impl Unpin for Workers
where Align4<u32>: Unpin, Align1<u8>: Unpin, *const Waiter is !null: Unpin, Align8<usize>: Unpin, *const u8 is !null: Unpin, Arc<Mutex<Option<Worker>>>: Unpin,

§

impl UnsafeUnpin for Workers
where Align4<u32>: UnsafeUnpin, Align1<u8>: UnsafeUnpin, *const Waiter is !null: UnsafeUnpin, Align8<usize>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<(Ident, Arc<Mutex<Option<Worker>>>)>: UnsafeUnpin,

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.