[][src]Struct mediasoup::worker::Worker

pub struct Worker { /* fields omitted */ }

A worker represents a mediasoup C++ subprocess that runs on a single CPU core and handles Router instances.

Implementations

impl Worker[src]

pub fn pid(&self) -> u32[src]

The PID of the worker process.

pub fn app_data(&self) -> &AppData[src]

Custom application data.

pub fn closed(&self) -> bool[src]

Whether the worker is closed.

pub async fn get_resource_usage(
    &self
) -> Result<WorkerResourceUsage, RequestError>
[src]

Provides resource usage of the mediasoup-worker subprocess.

pub async fn update_settings(
    &self,
    data: WorkerUpdateSettings
) -> Result<(), RequestError>
[src]

Updates the worker settings in runtime. Just a subset of the worker settings can be updated.

pub async fn create_router(
    &self,
    router_options: RouterOptions
) -> Result<Router, CreateRouterError>
[src]

Create a Router.

Worker will be kept alive as long as at least one router instance is alive.

pub fn on_new_router<F: Fn(&Router) + Send + Sync + 'static>(
    &self,
    callback: F
) -> HandlerId
[src]

Callback is called when a new router is created.

pub fn on_dead<F: FnOnce(ExitStatus) + Send + Sync + 'static>(
    &self,
    callback: F
) -> HandlerId
[src]

Callback is called when the worker process unexpectedly dies.

pub fn on_close<F: FnOnce() + Send + 'static>(&self, callback: F) -> HandlerId[src]

Callback is called when the worker is closed for whatever reason.

Trait Implementations

impl Clone for Worker[src]

Auto Trait Implementations

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